diff --git a/src/CppParser/AST.cpp b/src/CppParser/AST.cpp index b2577696..80fc6ddb 100644 --- a/src/CppParser/AST.cpp +++ b/src/CppParser/AST.cpp @@ -166,7 +166,7 @@ DEF_VECTOR(DeclarationContext, Template*, Templates) DEF_VECTOR(DeclarationContext, TypedefDecl*, Typedefs) DEF_VECTOR(DeclarationContext, Variable*, Variables) -Declaration* DeclarationContext::FindAnonymous(uint64_t key) +Declaration* DeclarationContext::FindAnonymous(const std::string& key) { auto it = Anonymous.find(key); return (it != Anonymous.end()) ? it->second : 0; diff --git a/src/CppParser/AST.h b/src/CppParser/AST.h index 163f1ce4..bfe05d7e 100644 --- a/src/CppParser/AST.h +++ b/src/CppParser/AST.h @@ -395,7 +395,7 @@ struct CS_API DeclarationContext : public Declaration { DeclarationContext(DeclarationKind kind); - CS_IGNORE Declaration* FindAnonymous(uint64_t key); + CS_IGNORE Declaration* FindAnonymous(const std::string& USR); CS_IGNORE CppSharp::CppParser::AST::Namespace* FindNamespace(const std::string& Name); CS_IGNORE CppSharp::CppParser::AST::Namespace* FindNamespace(const std::vector&); @@ -424,7 +424,7 @@ struct CS_API DeclarationContext : public Declaration VECTOR(Template*, Templates) VECTOR(TypedefDecl*, Typedefs) VECTOR(Variable*, Variables) - std::map Anonymous; + std::map Anonymous; bool IsAnonymous; }; diff --git a/src/CppParser/Parser.cpp b/src/CppParser/Parser.cpp index de9a8c53..04a3b8be 100644 --- a/src/CppParser/Parser.cpp +++ b/src/CppParser/Parser.cpp @@ -578,7 +578,8 @@ Class* Parser::GetRecord(clang::RecordDecl* Record, bool& Process) if (HasEmptyName) { - if (auto AR = NS->FindAnonymous((uint64_t)Record)) + auto USR = GetDeclUSR(Record); + if (auto AR = NS->FindAnonymous(USR)) RC = static_cast(AR); } else @@ -593,7 +594,10 @@ Class* Parser::GetRecord(clang::RecordDecl* Record, bool& Process) HandleDeclaration(Record, RC); if (HasEmptyName) - NS->Anonymous[(uint64_t)Record] = RC; + { + auto USR = GetDeclUSR(Record); + NS->Anonymous[USR] = RC; + } if (!isCompleteDefinition) return RC;