Changeset c36a419
- Timestamp:
- Nov 21, 2023, 2:27:10 PM (13 months ago)
- Branches:
- master
- Children:
- 8984003
- Parents:
- 4883712
- Location:
- src/AST
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Decl.cpp
r4883712 rc36a419 33 33 static UniqueId lastUniqueId = 0; 34 34 35 using IdMapType = std::unordered_map< UniqueId, readonly<Decl> >;36 static IdMapType idMap;37 38 35 void Decl::fixUniqueId() { 39 36 if ( uniqueId ) return; // ensure only set once 40 37 uniqueId = ++lastUniqueId; 41 // The extra readonly pointer is causing some reference counting issues.42 // idMap[ uniqueId ] = this;43 }44 45 readonly<Decl> Decl::fromId( UniqueId id ) {46 // Right now this map is always empty, so don't use it.47 assert( false );48 IdMapType::const_iterator i = idMap.find( id );49 if ( i != idMap.end() ) return i->second;50 return {};51 38 } 52 39 -
src/AST/Decl.hpp
r4883712 rc36a419 56 56 /// Ensures this node has a unique ID 57 57 void fixUniqueId(); 58 /// Get canonical declaration for unique ID59 static readonly<Decl> fromId( UniqueId id );60 58 61 59 const Decl * accept( Visitor & v ) const override = 0;
Note: See TracChangeset
for help on using the changeset viewer.