Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Declaration.cc

    raaeacf4 r77bfc80  
    2727
    2828static UniqueId lastUniqueId = 0;
     29typedef std::map< UniqueId, Declaration* > IdMapType;
     30static IdMapType idMap;
    2931
    3032Declaration::Declaration( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage )
     
    4345        if ( uniqueId ) return;
    4446        uniqueId = ++lastUniqueId;
     47        idMap[ uniqueId ] = this;
    4548}
     49
     50Declaration *Declaration::declFromId( UniqueId id ) {
     51        IdMapType::const_iterator i = idMap.find( id );
     52        return i != idMap.end() ? i->second : 0;
     53}
     54
     55void 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
    4663
    4764AsmDecl::AsmDecl( AsmStmt *stmt ) : Declaration( "", Type::StorageClasses(), LinkageSpec::C ), stmt( stmt ) {
Note: See TracChangeset for help on using the changeset viewer.