diff options
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/AST/ODRHash.cpp | 27 | ||||
-rw-r--r-- | clang/lib/AST/StmtProfile.cpp | 5 |
2 files changed, 19 insertions, 13 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) { diff --git a/clang/lib/AST/StmtProfile.cpp b/clang/lib/AST/StmtProfile.cpp index f1fbe2806b5..99a25f34252 100644 --- a/clang/lib/AST/StmtProfile.cpp +++ b/clang/lib/AST/StmtProfile.cpp @@ -186,10 +186,7 @@ namespace { Hash.AddTemplateName(Name); } void VisitNestedNameSpecifier(NestedNameSpecifier *NNS) override { - ID.AddBoolean(NNS); - if (NNS) { - Hash.AddNestedNameSpecifier(NNS); - } + Hash.AddNestedNameSpecifier(NNS); } }; } |