Changeset be8bd88 for src/Parser/ParseNode.h
- Timestamp:
- Mar 8, 2017, 3:22:50 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 031a2c95, 0e7ea335
- Parents:
- 87c3bef (diff), 6363ad1 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/ParseNode.h
r87c3bef rbe8bd88 10 10 // Created On : Sat May 16 13:28:16 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Feb 23 15:22:10201713 // Update Count : 66212 // Last Modified On : Tue Mar 7 08:10:53 2017 13 // Update Count : 726 14 14 // 15 15 … … 19 19 #include <string> 20 20 #include <list> 21 #include <bitset> 21 22 #include <iterator> 22 23 #include <memory> … … 39 40 //############################################################################## 40 41 41 extern char * yyfilename;42 extern char * yyfilename; 42 43 extern int yylineno; 43 44 … … 122 123 } 123 124 124 Expression * build() const { return const_cast<ExpressionNode *>(this)->expr.release(); }125 Expression * build() const { return const_cast<ExpressionNode *>(this)->expr.release(); } 125 126 private: 126 127 bool extension = false; … … 203 204 // These must remain in the same order as the corresponding DeclarationNode names. 204 205 205 // enum StorageClass { Extern, Static, Auto, Register, NoStorageClass }; 206 // enum FunctionSpec { Inline, Fortran, Noreturn, NoFunctionSpec }; 207 // enum Qualifier { Const, Restrict, Volatile, Lvalue, Atomic, Threadlocal, Mutex, NoQualifier }; 208 209 enum StorageClass { Extern, Static, Auto, Register, Inline, Fortran, Noreturn, Threadlocal, NoStorageClass, }; 210 enum Qualifier { Const, Restrict, Volatile, Lvalue, Atomic, NoQualifier }; 206 enum StorageClass { Extern, Static, Auto, Register, Threadlocal, NoStorageClass, 207 ExternClass = 1 << Extern, StaticClass = 1 << Static, AutoClass = 1 << Auto, RegisterClass = 1 << Register, ThreadlocalClass = 1 << Threadlocal }; 208 enum FuncSpecifier { Inline, Noreturn, Fortran, NoFuncSpecifier, 209 InlineSpec = 1 << Inline, NoreturnSpec = 1 << Noreturn, FortranSpec = 1 << Fortran }; 210 enum TypeQualifier { Const, Restrict, Volatile, Lvalue, Mutex, Atomic, NoTypeQualifier }; 211 211 enum BasicType { Void, Bool, Char, Int, Float, Double, LongDouble, NoBasicType }; 212 212 enum ComplexType { Complex, Imaginary, NoComplexType }; … … 217 217 enum BuiltinType { Valist, Zero, One, NoBuiltinType }; 218 218 219 static const char * storageName[]; 220 static const char * qualifierName[]; 221 static const char * basicTypeName[]; 222 static const char * complexTypeName[]; 223 static const char * signednessName[]; 224 static const char * lengthName[]; 225 static const char * aggregateName[]; 226 static const char * typeClassName[]; 227 static const char * builtinTypeName[]; 228 229 static DeclarationNode * newFunction( std::string * name, DeclarationNode * ret, DeclarationNode * param, StatementNode * body, bool newStyle = false ); 230 static DeclarationNode * newQualifier( Qualifier ); 231 static DeclarationNode * newForall( DeclarationNode * ); 219 static const char * storageClassNames[]; 220 static const char * funcSpecifierNames[]; 221 static const char * typeQualifierNames[]; 222 static const char * basicTypeNames[]; 223 static const char * complexTypeNames[]; 224 static const char * signednessNames[]; 225 static const char * lengthNames[]; 226 static const char * aggregateNames[]; 227 static const char * typeClassNames[]; 228 static const char * builtinTypeNames[]; 229 232 230 static DeclarationNode * newStorageClass( StorageClass ); 231 static DeclarationNode * newFuncSpecifier( FuncSpecifier ); 232 static DeclarationNode * newTypeQualifier( TypeQualifier ); 233 233 static DeclarationNode * newBasicType( BasicType ); 234 234 static DeclarationNode * newComplexType( ComplexType ); 235 static DeclarationNode * newSignedNess( Signedness sn);236 static DeclarationNode * newLength( Length lnth);235 static DeclarationNode * newSignedNess( Signedness ); 236 static DeclarationNode * newLength( Length ); 237 237 static DeclarationNode * newBuiltinType( BuiltinType ); 238 static DeclarationNode * newForall( DeclarationNode * ); 238 239 static DeclarationNode * newFromTypedef( std::string * ); 240 static DeclarationNode * newFunction( std::string * name, DeclarationNode * ret, DeclarationNode * param, StatementNode * body, bool newStyle = false ); 239 241 static DeclarationNode * newAggregate( Aggregate kind, const std::string * name, ExpressionNode * actuals, DeclarationNode * fields, bool body ); 240 242 static DeclarationNode * newEnum( std::string * name, DeclarationNode * constants, bool body ); … … 263 265 DeclarationNode * addQualifiers( DeclarationNode * ); 264 266 void checkQualifiers( const TypeData *, const TypeData * ); 265 void checkS torageClasses( DeclarationNode * );266 DeclarationNode * copyS torageClasses( DeclarationNode * );267 void checkSpecifiers( DeclarationNode * ); 268 DeclarationNode * copySpecifiers( DeclarationNode * ); 267 269 DeclarationNode * addType( DeclarationNode * ); 268 270 DeclarationNode * addTypedef(); … … 295 297 296 298 Declaration * build() const; 297 ::Type * buildType() const;299 Type * buildType() const; 298 300 299 301 bool get_hasEllipsis() const; … … 301 303 DeclarationNode * extractAggregate() const; 302 304 bool has_enumeratorValue() const { return (bool)enumeratorValue; } 303 ExpressionNode * consume_enumeratorValue() const { return const_cast<DeclarationNode *>(this)->enumeratorValue.release(); }305 ExpressionNode * consume_enumeratorValue() const { return const_cast<DeclarationNode *>(this)->enumeratorValue.release(); } 304 306 305 307 bool get_extension() const { return extension; } … … 323 325 324 326 TypeData * type; 325 StorageClass storageClass; 327 328 typedef std::bitset< DeclarationNode::NoStorageClass > StorageClasses; 329 StorageClasses storageClasses; 330 static void print_StorageClass( std::ostream & output, StorageClasses storageClasses ); 331 332 typedef std::bitset< DeclarationNode::NoFuncSpecifier > FuncSpecifiers; 333 FuncSpecifiers funcSpecs; 334 static void print_FuncSpec( std::ostream & output, FuncSpecifiers funcSpecs ); 335 326 336 ExpressionNode * bitfieldWidth; 327 bool isInline, isNoreturn;328 337 std::unique_ptr<ExpressionNode> enumeratorValue; 329 338 bool hasEllipsis; … … 342 351 343 352 static inline Type * maybeMoveBuildType( const DeclarationNode * orig ) { 344 Type * ret = orig ? orig->buildType() : nullptr;353 Type * ret = orig ? orig->buildType() : nullptr; 345 354 delete orig; 346 355 return ret; … … 357 366 358 367 virtual StatementNode * clone() const final { assert( false ); return nullptr; } 359 Statement * build() const { return const_cast<StatementNode *>(this)->stmt.release(); }368 Statement * build() const { return const_cast<StatementNode *>(this)->stmt.release(); } 360 369 361 370 virtual StatementNode * add_label( const std::string * name, DeclarationNode * attr = nullptr ) {
Note: See TracChangeset
for help on using the changeset viewer.