Changes in src/Parser/ExpressionNode.cc [ac10576:d56e5bc]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/ExpressionNode.cc
rac10576 rd56e5bc 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 13:17:07 2015 11 // Last Modified By : Andrew Beach12 // Last Modified On : Tus Jul 18 10:08:00201713 // Update Count : 5 5011 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jun 21 16:44:46 2017 13 // Update Count : 541 14 14 // 15 15 … … 27 27 #include "SynTree/Declaration.h" 28 28 #include "Common/UnimplementedError.h" 29 #include "parse rutility.h"29 #include "parseutility.h" 30 30 #include "Common/utility.h" 31 31 … … 46 46 // type. 47 47 48 Type::Qualifiers noQualifiers; // no qualifiers on constants48 Type::Qualifiers emptyQualifiers; // no qualifiers on constants 49 49 50 50 static inline bool checkU( char c ) { return c == 'u' || c == 'U'; } … … 118 118 } // if 119 119 120 Expression * ret = new ConstantExpr( Constant( new BasicType( noQualifiers, kind[Unsigned][size] ), str, v ) );120 Expression * ret = new ConstantExpr( Constant( new BasicType( emptyQualifiers, kind[Unsigned][size] ), str, v ) ); 121 121 delete &str; // created by lex 122 122 return ret; … … 153 153 } // if 154 154 155 Expression * ret = new ConstantExpr( Constant( new BasicType( noQualifiers, kind[complx][size] ), str, v ) );155 Expression * ret = new ConstantExpr( Constant( new BasicType( emptyQualifiers, kind[complx][size] ), str, v ) ); 156 156 delete &str; // created by lex 157 157 return ret; … … 159 159 160 160 Expression *build_constantChar( const std::string & str ) { 161 Expression * ret = new ConstantExpr( Constant( new BasicType( noQualifiers, BasicType::Char ), str, (unsigned long long int)(unsigned char)str[1] ) );161 Expression * ret = new ConstantExpr( Constant( new BasicType( emptyQualifiers, BasicType::Char ), str, (unsigned long long int)(unsigned char)str[1] ) ); 162 162 delete &str; // created by lex 163 163 return ret; … … 166 166 ConstantExpr *build_constantStr( const std::string & str ) { 167 167 // string should probably be a primitive type 168 ArrayType *at = new ArrayType( noQualifiers, new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ),168 ArrayType *at = new ArrayType( emptyQualifiers, new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ), 169 169 new ConstantExpr( Constant::from_ulong( str.size() + 1 - 2 ) ), // +1 for '\0' and -2 for '"' 170 170 false, false ); … … 176 176 177 177 Expression *build_constantZeroOne( const std::string & str ) { 178 Expression * ret = new ConstantExpr( Constant( str == "0" ? (Type *)new ZeroType( noQualifiers ) : (Type*)new OneType( noQualifiers ), str,178 Expression * ret = new ConstantExpr( Constant( str == "0" ? (Type *)new ZeroType( emptyQualifiers ) : (Type*)new OneType( emptyQualifiers ), str, 179 179 str == "0" ? (unsigned long long int)0 : (unsigned long long int)1 ) ); 180 180 delete &str; // created by lex … … 231 231 } 232 232 233 // Must harmonize with OperKinds.234 233 static const char *OperName[] = { 235 234 // diadic 236 "SizeOf", "AlignOf", "OffsetOf", "?+?", "?-?", "? \\?", "?*?", "?/?", "?%?", "||", "&&",235 "SizeOf", "AlignOf", "OffsetOf", "?+?", "?-?", "?*?", "?/?", "?%?", "||", "&&", 237 236 "?|?", "?&?", "?^?", "Cast", "?<<?", "?>>?", "?<?", "?>?", "?<=?", "?>=?", "?==?", "?!=?", 238 "?=?", "?@=?", "? \\=?", "?*=?", "?/=?", "?%=?", "?+=?", "?-=?", "?<<=?", "?>>=?", "?&=?", "?^=?", "?|=?",237 "?=?", "?@=?", "?*=?", "?/=?", "?%=?", "?+=?", "?-=?", "?<<=?", "?>>=?", "?&=?", "?^=?", "?|=?", 239 238 "?[?]", "...", 240 239 // monadic … … 349 348 350 349 Expression *build_valexpr( StatementNode *s ) { 351 return new StmtExpr( dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >(s) ));350 return new UntypedValofExpr( maybeMoveBuild< Statement >(s), nullptr ); 352 351 } 353 352 Expression *build_typevalue( DeclarationNode *decl ) {
Note:
See TracChangeset
for help on using the changeset viewer.