[PATCH] D22188: clang-tidy/readability-identifier-naming: crash on DependentTemplateSpecializationType
Matthias Gehre via cfe-commits
cfe-commits at lists.llvm.org
Sat Jul 9 12:48:13 PDT 2016
mgehre created this revision.
mgehre added a reviewer: alexfh.
mgehre added a subscriber: cfe-commits.
Previously, the added test cases crashed because Ref.getTypePtr()->getAsTagDecl()
is nullptr.
http://reviews.llvm.org/D22188
Files:
clang-tidy/readability/IdentifierNamingCheck.cpp
test/clang-tidy/readability-identifier-naming.cpp
Index: test/clang-tidy/readability-identifier-naming.cpp
===================================================================
--- test/clang-tidy/readability-identifier-naming.cpp
+++ test/clang-tidy/readability-identifier-naming.cpp
@@ -344,3 +344,7 @@
// CHECK-FIXES: {{^}}void MY_TEST_MACRO(function) {}
}
}
+
+template <typename t_t> struct a {
+ typename t_t::template b<> c;
+};
Index: clang-tidy/readability/IdentifierNamingCheck.cpp
===================================================================
--- clang-tidy/readability/IdentifierNamingCheck.cpp
+++ clang-tidy/readability/IdentifierNamingCheck.cpp
@@ -663,8 +663,9 @@
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;
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22188.63396.patch
Type: text/x-patch
Size: 1018 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160709/e51507ce/attachment.bin>
More information about the cfe-commits
mailing list