diff options
-rw-r--r-- | clang/include/clang/AST/ODRHash.h | 3 | ||||
-rw-r--r-- | clang/lib/AST/ODRHash.cpp | 12 | ||||
-rw-r--r-- | clang/test/Modules/Inputs/odr_hash-Unresolved/class.h | 1 |
3 files changed, 13 insertions, 3 deletions
diff --git a/clang/include/clang/AST/ODRHash.h b/clang/include/clang/AST/ODRHash.h index 0298887d1b1..feaa83844a1 100644 --- a/clang/include/clang/AST/ODRHash.h +++ b/clang/include/clang/AST/ODRHash.h @@ -91,6 +91,9 @@ public: void AddBoolean(bool value); static bool isWhitelistedDecl(const Decl* D, const DeclContext *Parent); + +private: + void AddDeclarationNameImpl(DeclarationName Name); }; } // end namespace clang diff --git a/clang/lib/AST/ODRHash.cpp b/clang/lib/AST/ODRHash.cpp index 1624468079a..3aeb7e6fbb2 100644 --- a/clang/lib/AST/ODRHash.cpp +++ b/clang/lib/AST/ODRHash.cpp @@ -34,8 +34,17 @@ void ODRHash::AddIdentifierInfo(const IdentifierInfo *II) { void ODRHash::AddDeclarationName(DeclarationName Name, bool TreatAsDecl) { if (TreatAsDecl) + // Matches the NamedDecl check in AddDecl AddBoolean(true); + AddDeclarationNameImpl(Name); + + if (TreatAsDecl) + // Matches the ClassTemplateSpecializationDecl check in AddDecl + AddBoolean(false); +} + +void ODRHash::AddDeclarationNameImpl(DeclarationName Name) { // Index all DeclarationName and use index numbers to refer to them. auto Result = DeclNameMap.insert(std::make_pair(Name, DeclNameMap.size())); ID.AddInteger(Result.first->second); @@ -91,9 +100,6 @@ void ODRHash::AddDeclarationName(DeclarationName Name, bool TreatAsDecl) { } } } - - if (TreatAsDecl) - AddBoolean(false); } void ODRHash::AddNestedNameSpecifier(const NestedNameSpecifier *NNS) { diff --git a/clang/test/Modules/Inputs/odr_hash-Unresolved/class.h b/clang/test/Modules/Inputs/odr_hash-Unresolved/class.h index fe3a7116f9b..8a3c9f941f7 100644 --- a/clang/test/Modules/Inputs/odr_hash-Unresolved/class.h +++ b/clang/test/Modules/Inputs/odr_hash-Unresolved/class.h @@ -6,6 +6,7 @@ class S { void run() { int x; A::Check(&Field, 1); + A::Check(&Field, 1); } }; #endif |