forked from OSchip/llvm-project
[clang] Fix crash on visiting null nestedNameSpecifier.
Summary: Fix https://github.com/clangd/clangd/issues/293 Reviewers: sammccall Subscribers: ilya-biryukov, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D76320
This commit is contained in:
parent
c3df69faa0
commit
bd763e2cf7
|
@ -5928,7 +5928,9 @@ bool UnnamedLocalNoLinkageFinder::VisitDependentNameType(
|
|||
|
||||
bool UnnamedLocalNoLinkageFinder::VisitDependentTemplateSpecializationType(
|
||||
const DependentTemplateSpecializationType* T) {
|
||||
return VisitNestedNameSpecifier(T->getQualifier());
|
||||
if (auto *Q = T->getQualifier())
|
||||
return VisitNestedNameSpecifier(Q);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool UnnamedLocalNoLinkageFinder::VisitPackExpansionType(
|
||||
|
@ -5982,6 +5984,7 @@ bool UnnamedLocalNoLinkageFinder::VisitTagDecl(const TagDecl *Tag) {
|
|||
|
||||
bool UnnamedLocalNoLinkageFinder::VisitNestedNameSpecifier(
|
||||
NestedNameSpecifier *NNS) {
|
||||
assert(NNS);
|
||||
if (NNS->getPrefix() && VisitNestedNameSpecifier(NNS->getPrefix()))
|
||||
return true;
|
||||
|
||||
|
|
|
@ -273,3 +273,9 @@ namespace AnnotateAfterInvalidTemplateId {
|
|||
namespace PR45063 {
|
||||
template<class=class a::template b<>> struct X {}; // expected-error {{undeclared identifier 'a'}}
|
||||
}
|
||||
|
||||
namespace NoCrashOnEmptyNestedNameSpecifier {
|
||||
template <typename FnT,
|
||||
typename T = typename ABC<FnT>::template arg_t<0>> // expected-error {{no template named 'ABC'}}
|
||||
void foo(FnT) {}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue