Changeset 68fe077a for src/Parser/ParseNode.h
- Timestamp:
- Mar 16, 2017, 8:23:42 AM (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:
- 26ba208
- Parents:
- 6e8bd43
- git-author:
- Peter A. Buhr <pabuhr@…> (03/16/17 08:19:39)
- git-committer:
- Peter A. Buhr <pabuhr@…> (03/16/17 08:23:42)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/ParseNode.h
r6e8bd43 r68fe077a 10 10 // Created On : Sat May 16 13:28:16 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Mar 15 23:31:02201713 // Update Count : 77 012 // Last Modified On : Thu Mar 16 07:46:33 2017 13 // Update Count : 772 14 14 // 15 15 … … 201 201 class DeclarationNode : public ParseNode { 202 202 public: 203 // These must remain in the same order as the corresponding DeclarationNode names.204 205 enum { Extern = 1 << 0, Static = 1 << 1, Auto = 1 << 2, Register = 1 << 3, Threadlocal = 1 << 4, NumStorageClass = 5 };206 union StorageClasses {207 static const char * Names[];208 unsigned int val;209 struct {210 bool is_extern : 1;211 bool is_static : 1;212 bool is_auto : 1;213 bool is_register : 1;214 bool is_threadlocal : 1;215 };216 217 StorageClasses() : val( 0 ) {}218 StorageClasses( unsigned int val ) : val( val ) {}219 bool operator[]( unsigned int i ) const { return val & (1 << i); }220 bool any() const { return val != 0; }221 void print( std::ostream & os ) const {222 if ( (*this).any() ) { // any storage classes ?223 for ( unsigned int i = 0; i < NumStorageClass; i += 1 ) {224 if ( (*this)[i] ) {225 os << StorageClasses::Names[i] << ' ';226 } // if227 } // for228 } // if229 }230 }; // StorageClasses231 232 203 enum { Inline = 1 << 0, Noreturn = 1 << 1, Fortran = 1 << 2, NumFuncSpecifier = 3 }; 233 204 union FuncSpecifiers { … … 270 241 static const char * builtinTypeNames[]; 271 242 272 static DeclarationNode * newStorageClass( StorageClasses );243 static DeclarationNode * newStorageClass( Type::StorageClasses ); 273 244 static DeclarationNode * newFuncSpecifier( FuncSpecifiers ); 274 245 static DeclarationNode * newTypeQualifier( Type::Qualifiers ); … … 368 339 TypeData * type; 369 340 370 StorageClasses storageClasses;341 Type::StorageClasses storageClasses; 371 342 FuncSpecifiers funcSpecs; 372 343
Note: See TracChangeset
for help on using the changeset viewer.