diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-06-10 19:17:14 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-06-10 19:17:14 +0000 |
| commit | db17bf38c59bc172953ed66cfe1b10c03c6bc383 (patch) | |
| tree | 2712281fec99b99c2fcafd5b46439dfdd93261aa /contrib/llvm/tools/clang/lib/AST/ODRHash.cpp | |
| parent | 686fb94a00297bf9ff49d93b948925552a2ce8e0 (diff) | |
| parent | 7ab83427af0f77b59941ceba41d509d7d097b065 (diff) | |
Notes
Diffstat (limited to 'contrib/llvm/tools/clang/lib/AST/ODRHash.cpp')
| -rw-r--r-- | contrib/llvm/tools/clang/lib/AST/ODRHash.cpp | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/contrib/llvm/tools/clang/lib/AST/ODRHash.cpp b/contrib/llvm/tools/clang/lib/AST/ODRHash.cpp index 0e822ce35b8c..08593da89bbd 100644 --- a/contrib/llvm/tools/clang/lib/AST/ODRHash.cpp +++ b/contrib/llvm/tools/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) { |
