Changeset 64b6913 for src/Parser/DeclarationNode.cc
- Timestamp:
- Mar 16, 2017, 8:19:39 AM (8 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
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/DeclarationNode.cc
r6e8bd43 r64b6913 10 10 // Created On : Sat May 16 12:34:05 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Mar 15 23:36:49201713 // Update Count : 99712 // Last Modified On : Thu Mar 16 07:59:40 2017 13 // Update Count : 1003 14 14 // 15 15 … … 33 33 34 34 // These must remain in the same order as the corresponding DeclarationNode enumerations. 35 const char * DeclarationNode::StorageClasses::Names[] = { "extern", "static", "auto", "register", "_Thread_local", "NoStorageClassNames" };36 35 const char * DeclarationNode::FuncSpecifiers::Names[] = { "inline", "fortran", "_Noreturn", "NoFunctionSpecifierNames" }; 37 36 const char * DeclarationNode::basicTypeNames[] = { "void", "_Bool", "char", "int", "float", "double", "long double", "NoBasicTypeNames" }; … … 181 180 182 181 183 DeclarationNode * DeclarationNode::newStorageClass( StorageClasses sc ) {182 DeclarationNode * DeclarationNode::newStorageClass( Type::StorageClasses sc ) { 184 183 DeclarationNode * newnode = new DeclarationNode; 185 184 newnode->storageClasses = sc; … … 458 457 if ( storageClasses.any() && src->storageClasses.any() ) { // any reason to check ? 459 458 if ( (storageClasses.val & src->storageClasses.val ) != 0 ) { // duplicates ? 460 for ( unsigned int i = 0; i < NumStorageClass; i += 1 ) { // find duplicates459 for ( unsigned int i = 0; i < Type::NumStorageClass; i += 1 ) { // find duplicates 461 460 if ( storageClasses[i] && src->storageClasses[i] ) { 462 appendError( error, string( "duplicate " ) + StorageClasses::Names[i] );461 appendError( error, string( "duplicate " ) + Type::StorageClasses::Names[i] ); 463 462 } // if 464 463 } // for 465 464 // src is the new item being added and has a single bit 466 465 } else if ( ! src->storageClasses.is_threadlocal ) { // conflict ? 467 appendError( error, string( "conflicting " ) + StorageClasses::Names[ffs( storageClasses.val ) - 1] +468 " & " + StorageClasses::Names[ffs( src->storageClasses.val ) - 1] );466 appendError( error, string( "conflicting " ) + Type::StorageClasses::Names[ffs( storageClasses.val ) - 1] + 467 " & " + Type::StorageClasses::Names[ffs( src->storageClasses.val ) - 1] ); 469 468 src->storageClasses.val = 0; // FIX to preserve invariant of one basic storage specifier 470 469 } // if … … 970 969 } else if ( StructDecl * agg = dynamic_cast< StructDecl * >( decl ) ) { 971 970 StructInstType * inst = new StructInstType( Type::Qualifiers(), agg->get_name() ); 972 auto obj = new ObjectDecl( "", DeclarationNode::StorageClasses(), linkage, nullptr, inst, nullptr );971 auto obj = new ObjectDecl( "", Type::StorageClasses(), linkage, nullptr, inst, nullptr ); 973 972 obj->location = cur->location; 974 973 * out++ = obj; … … 976 975 } else if ( UnionDecl * agg = dynamic_cast< UnionDecl * >( decl ) ) { 977 976 UnionInstType * inst = new UnionInstType( Type::Qualifiers(), agg->get_name() ); 978 auto obj = new ObjectDecl( "", DeclarationNode::StorageClasses(), linkage, nullptr, inst, nullptr );977 auto obj = new ObjectDecl( "", Type::StorageClasses(), linkage, nullptr, inst, nullptr ); 979 978 obj->location = cur->location; 980 979 * out++ = obj; … … 1023 1022 assertf( sizeof(kindMap)/sizeof(kindMap[0] == NoTypeClass-1), "DeclarationNode::build: kindMap is out of sync." ); 1024 1023 assertf( variable.tyClass < sizeof(kindMap)/sizeof(kindMap[0]), "Variable's tyClass is out of bounds." ); 1025 TypeDecl * ret = new TypeDecl( *name, DeclarationNode::StorageClasses(), nullptr, kindMap[ variable.tyClass ] );1024 TypeDecl * ret = new TypeDecl( *name, Type::StorageClasses(), nullptr, kindMap[ variable.tyClass ] ); 1026 1025 buildList( variable.assertions, ret->get_assertions() ); 1027 1026 return ret;
Note: See TracChangeset
for help on using the changeset viewer.