summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ODRHash.cpp
diff options
context:
space:
mode:
authorRichard Trieu <rtrieu@google.com>2017-06-09 20:11:51 +0000
committerRichard Trieu <rtrieu@google.com>2017-06-09 20:11:51 +0000
commitf21b80387644c47d2cf3518fed934496f6b55524 (patch)
treec70a1a2f4ced482ce47e50140fe1853e8e25c567 /clang/lib/AST/ODRHash.cpp
parent29e23f3ccf63bba92fd6e6fccde0f19b02dda790 (diff)
downloadbcm5719-llvm-f21b80387644c47d2cf3518fed934496f6b55524.tar.gz
bcm5719-llvm-f21b80387644c47d2cf3518fed934496f6b55524.zip
[ODRHash] Skip inline namespaces when hashing.
Speculatively try to fix the underlying issue from r304592, of underlying types being confused when inline namespaces are used. llvm-svn: 305104
Diffstat (limited to 'clang/lib/AST/ODRHash.cpp')
-rw-r--r--clang/lib/AST/ODRHash.cpp27
1 files changed, 18 insertions, 9 deletions
diff --git a/clang/lib/AST/ODRHash.cpp b/clang/lib/AST/ODRHash.cpp
index 0e822ce35b8..08593da89bb 100644
--- a/clang/lib/AST/ODRHash.cpp
+++ b/clang/lib/AST/ODRHash.cpp
@@ -82,13 +82,25 @@ void ODRHash::AddDeclarationName(DeclarationName Name) {
}
void ODRHash::AddNestedNameSpecifier(const NestedNameSpecifier *NNS) {
- assert(NNS && "Expecting non-null pointer.");
- const auto *Prefix = NNS->getPrefix();
- AddBoolean(Prefix);
- if (Prefix) {
- AddNestedNameSpecifier(Prefix);
+ // Unlike the other pointer handling functions, allow null pointers here.
+ if (!NNS) {
+ AddBoolean(false);
+ return;
}
+
+ // Skip inlined namespaces.
auto Kind = NNS->getKind();
+ if (Kind == NestedNameSpecifier::Namespace) {
+ if (NNS->getAsNamespace()->isInline()) {
+ return AddNestedNameSpecifier(NNS->getPrefix());
+ }
+ }
+
+ AddBoolean(true);
+
+ // Process prefix
+ AddNestedNameSpecifier(NNS->getPrefix());
+
ID.AddInteger(Kind);
switch (Kind) {
case NestedNameSpecifier::Identifier:
@@ -381,10 +393,7 @@ public:
}
void AddNestedNameSpecifier(const NestedNameSpecifier *NNS) {
- Hash.AddBoolean(NNS);
- if (NNS) {
- Hash.AddNestedNameSpecifier(NNS);
- }
+ Hash.AddNestedNameSpecifier(NNS);
}
void AddIdentifierInfo(const IdentifierInfo *II) {
OpenPOWER on IntegriCloud