Changes in src/Parser/ParseNode.h [a7c90d4:e496303]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/ParseNode.h
ra7c90d4 re496303 10 10 // Created On : Sat May 16 13:28:16 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Mar 7 08:10:53201713 // Update Count : 7 2612 // Last Modified On : Tue Mar 14 16:53:19 2017 13 // Update Count : 757 14 14 // 15 15 … … 19 19 #include <string> 20 20 #include <list> 21 #include <bitset>22 21 #include <iterator> 23 22 #include <memory> … … 204 203 // These must remain in the same order as the corresponding DeclarationNode names. 205 204 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 }; 205 enum { Extern = 1 << 0, Static = 1 << 1, Auto = 1 << 2, Register = 1 << 3, Threadlocal = 1 << 4, NoStorageClass = 5 }; 206 union StorageClasses { 207 unsigned int val; 208 struct { 209 bool is_extern : 1; 210 bool is_static : 1; 211 bool is_auto : 1; 212 bool is_register : 1; 213 bool is_threadlocal : 1; 214 }; 215 StorageClasses() : val( 0 ) {} 216 StorageClasses( unsigned int val ) : val( val ) {} 217 bool operator[]( unsigned int i ) const { return val & (1 << i); } 218 }; // StorageClasses 219 220 enum { Inline = 1 << 0, Noreturn = 1 << 1, Fortran = 1 << 2, NoFuncSpecifier = 3 }; 221 union FuncSpecifiers { 222 unsigned int val; 223 struct { 224 bool is_inline : 1; 225 bool is_noreturn : 1; 226 bool is_fortran : 1; 227 }; 228 FuncSpecifiers() : val( 0 ) {} 229 FuncSpecifiers( unsigned int val ) : val( val ) {} 230 bool operator[]( unsigned int i ) const { return val & (1 << i); } 231 }; // FuncSpecifiers 232 233 enum { Const = 1 << 0, Restrict = 1 << 1, Volatile = 1 << 2, Lvalue = 1 << 3, Mutex = 1 << 4, Atomic = 1 << 5, NoTypeQualifier = 6 }; 234 union TypeQualifiers { 235 unsigned int val; 236 struct { 237 bool is_const : 1; 238 bool is_restrict : 1; 239 bool is_volatile : 1; 240 bool is_lvalue : 1; 241 bool is_mutex : 1; 242 bool is_atomic : 1; 243 }; 244 TypeQualifiers() : val( 0 ) {} 245 TypeQualifiers( unsigned int val ) : val( val ) {} 246 bool operator[]( unsigned int i ) const { return val & (1 << i); } 247 }; // TypeQualifiers 248 211 249 enum BasicType { Void, Bool, Char, Int, Float, Double, LongDouble, NoBasicType }; 212 250 enum ComplexType { Complex, Imaginary, NoComplexType }; … … 228 266 static const char * builtinTypeNames[]; 229 267 230 static DeclarationNode * newStorageClass( StorageClass );231 static DeclarationNode * newFuncSpecifier( FuncSpecifier );232 static DeclarationNode * newTypeQualifier( TypeQualifier );268 static DeclarationNode * newStorageClass( StorageClasses ); 269 static DeclarationNode * newFuncSpecifier( FuncSpecifiers ); 270 static DeclarationNode * newTypeQualifier( TypeQualifiers ); 233 271 static DeclarationNode * newBasicType( BasicType ); 234 272 static DeclarationNode * newComplexType( ComplexType ); … … 326 364 TypeData * type; 327 365 328 typedef std::bitset< DeclarationNode::NoStorageClass > StorageClasses;329 366 StorageClasses storageClasses; 330 367 static void print_StorageClass( std::ostream & output, StorageClasses storageClasses ); 331 368 332 typedef std::bitset< DeclarationNode::NoFuncSpecifier > FuncSpecifiers;333 369 FuncSpecifiers funcSpecs; 334 370 static void print_FuncSpec( std::ostream & output, FuncSpecifiers funcSpecs );
Note: See TracChangeset
for help on using the changeset viewer.