forked from OSchip/llvm-project
clang-tidy/readability-identifier-naming: crash on DependentTemplateSpecializationType
Summary: Previously, the added test cases crashed because the passed a null Decl to addUsage(). Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D22188 llvm-svn: 274985
This commit is contained in:
parent
177553511d
commit
a9e812b9cb
|
@ -656,15 +656,16 @@ void IdentifierNamingCheck::check(const MatchFinder::MatchResult &Result) {
|
|||
|
||||
SourceRange Range(Ref.getTemplateNameLoc(), Ref.getTemplateNameLoc());
|
||||
if (const auto *ClassDecl = dyn_cast<TemplateDecl>(Decl)) {
|
||||
addUsage(NamingCheckFailures, ClassDecl->getTemplatedDecl(), Range);
|
||||
if (const auto *TemplDecl = ClassDecl->getTemplatedDecl())
|
||||
addUsage(NamingCheckFailures, TemplDecl, Range);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (const auto &Ref =
|
||||
Loc->getAs<DependentTemplateSpecializationTypeLoc>()) {
|
||||
addUsage(NamingCheckFailures, Ref.getTypePtr()->getAsTagDecl(),
|
||||
Loc->getSourceRange());
|
||||
if (const auto *Decl = Ref.getTypePtr()->getAsTagDecl())
|
||||
addUsage(NamingCheckFailures, Decl, Loc->getSourceRange());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -344,3 +344,9 @@ void MY_TEST_Macro(function) {}
|
|||
// CHECK-FIXES: {{^}}void MY_TEST_MACRO(function) {}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename t_t> struct a {
|
||||
typename t_t::template b<> c;
|
||||
};
|
||||
|
||||
template <template <typename> class A> struct b { A<int> c; };
|
||||
|
|
Loading…
Reference in New Issue