Changes in src/SynTree/Declaration.cc [aaeacf4:3ed994e]
- File:
-
- 1 edited
-
src/SynTree/Declaration.cc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Declaration.cc
raaeacf4 r3ed994e 27 27 28 28 static UniqueId lastUniqueId = 0; 29 typedef std::map< UniqueId, Declaration* > IdMapType; 30 static IdMapType idMap; 29 31 30 32 Declaration::Declaration( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage ) 31 : name( name ), linkage( linkage ), uniqueId( 0 ), storageClasses( scs) {33 : name( name ), linkage( linkage ), storageClasses( scs ), uniqueId( 0 ) { 32 34 } 33 35 34 36 Declaration::Declaration( const Declaration &other ) 35 : BaseSyntaxNode( other ), name( other.name ), linkage( other.linkage ), extension( other.extension ), uniqueId( other.uniqueId ), storageClasses( other.storageClasses) {37 : BaseSyntaxNode( other ), name( other.name ), linkage( other.linkage ), extension( other.extension ), storageClasses( other.storageClasses ), uniqueId( other.uniqueId ) { 36 38 } 37 39 … … 43 45 if ( uniqueId ) return; 44 46 uniqueId = ++lastUniqueId; 47 idMap[ uniqueId ] = this; 45 48 } 49 50 Declaration *Declaration::declFromId( UniqueId id ) { 51 IdMapType::const_iterator i = idMap.find( id ); 52 return i != idMap.end() ? i->second : 0; 53 } 54 55 void Declaration::dumpIds( std::ostream &os ) { 56 for ( IdMapType::const_iterator i = idMap.begin(); i != idMap.end(); ++i ) { 57 os << i->first << " -> "; 58 i->second->printShort( os ); 59 os << std::endl; 60 } // for 61 } 62 46 63 47 64 AsmDecl::AsmDecl( AsmStmt *stmt ) : Declaration( "", Type::StorageClasses(), LinkageSpec::C ), stmt( stmt ) {
Note:
See TracChangeset
for help on using the changeset viewer.