summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorRichard Trieu <rtrieu@google.com>2018-09-14 01:15:28 +0000
committerRichard Trieu <rtrieu@google.com>2018-09-14 01:15:28 +0000
commitd8673901ab8fe5c104196d08b5c44da026f20870 (patch)
tree1ca90d89577b6302096a9836e663dc3f9f140c69 /clang/lib
parent847bd3316640a07dbef20029accc7905d836ecf8 (diff)
downloadbcm5719-llvm-d8673901ab8fe5c104196d08b5c44da026f20870.tar.gz
bcm5719-llvm-d8673901ab8fe5c104196d08b5c44da026f20870.zip
[ODRHash] Fix early exit that skipped code.
There is a bit of code at the end of AddDeclaration that should be run on every exit of the function. However, there was an early exit beforehand that could be triggered, which causes a small amount of data to skip the hashing, leading to false positive mismatch. Use a separate function so that this code is always run. llvm-svn: 342199
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/AST/ODRHash.cpp12
1 files changed, 9 insertions, 3 deletions
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) {
OpenPOWER on IntegriCloud