kbobyrev created this revision. kbobyrev added a reviewer: kadircet. Herald added subscribers: usaxena95, arphaman. kbobyrev requested review of this revision. Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov. Herald added a project: clang-tools-extra.
Happens when DestContext is LinkageSpecDecl and hense CurContext happens to be both not TagDecl and NamespaceDecl. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D107047 Files: clang-tools-extra/clangd/AST.cpp Index: clang-tools-extra/clangd/AST.cpp =================================================================== --- clang-tools-extra/clangd/AST.cpp +++ clang-tools-extra/clangd/AST.cpp @@ -119,17 +119,17 @@ (void)ReachedNS; NNS = NestedNameSpecifier::Create(Context, nullptr, false, TD->getTypeForDecl()); - } else { - ReachedNS = true; - auto *NSD = llvm::cast<NamespaceDecl>(CurContext); - NNS = NestedNameSpecifier::Create(Context, nullptr, NSD); - // Anonymous and inline namespace names are not spelled while qualifying a - // name, so skip those. - if (NSD->isAnonymousNamespace() || NSD->isInlineNamespace()) - continue; - } + } else + (auto *NSD = llvm::dyn_cast<NamespaceDecl>(CurContext)) { + ReachedNS = true; + NNS = NestedNameSpecifier::Create(Context, nullptr, NSD); + // Anonymous and inline namespace names are not spelled while qualifying + // a name, so skip those. + if (NSD->isAnonymousNamespace() || NSD->isInlineNamespace()) + continue; + } // Stop if this namespace is already visible at DestContext. - if (IsVisible(NNS)) + if (!NNS || IsVisible(NNS)) break; Parents.push_back(NNS);
Index: clang-tools-extra/clangd/AST.cpp =================================================================== --- clang-tools-extra/clangd/AST.cpp +++ clang-tools-extra/clangd/AST.cpp @@ -119,17 +119,17 @@ (void)ReachedNS; NNS = NestedNameSpecifier::Create(Context, nullptr, false, TD->getTypeForDecl()); - } else { - ReachedNS = true; - auto *NSD = llvm::cast<NamespaceDecl>(CurContext); - NNS = NestedNameSpecifier::Create(Context, nullptr, NSD); - // Anonymous and inline namespace names are not spelled while qualifying a - // name, so skip those. - if (NSD->isAnonymousNamespace() || NSD->isInlineNamespace()) - continue; - } + } else + (auto *NSD = llvm::dyn_cast<NamespaceDecl>(CurContext)) { + ReachedNS = true; + NNS = NestedNameSpecifier::Create(Context, nullptr, NSD); + // Anonymous and inline namespace names are not spelled while qualifying + // a name, so skip those. + if (NSD->isAnonymousNamespace() || NSD->isInlineNamespace()) + continue; + } // Stop if this namespace is already visible at DestContext. - if (IsVisible(NNS)) + if (!NNS || IsVisible(NNS)) break; Parents.push_back(NNS);
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits