This revision was automatically updated to reflect the committed changes. Closed by commit rL274985: clang-tidy/readability-identifier-naming: crash on… (authored by mgehre).
Changed prior to commit: http://reviews.llvm.org/D22188?vs=63397&id=63398#toc Repository: rL LLVM http://reviews.llvm.org/D22188 Files: clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming.cpp Index: clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp @@ -656,15 +656,16 @@ 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; } } Index: clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming.cpp =================================================================== --- clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming.cpp +++ clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming.cpp @@ -344,3 +344,9 @@ // 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; };
Index: clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp @@ -656,15 +656,16 @@ 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; } } Index: clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming.cpp =================================================================== --- clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming.cpp +++ clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming.cpp @@ -344,3 +344,9 @@ // 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; };
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits