[PATCH] D19331: [Clang-tidy] Fix for crash in modernize-raw-string-literal check

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 21 07:45:02 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL266992: [Clang-tidy] Fix for crash in modernize-raw-string-literal check (authored by alexfh).

Changed prior to commit:
  http://reviews.llvm.org/D19331?vs=54401&id=54504#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D19331

Files:
  clang-tools-extra/trunk/clang-tidy/modernize/RawStringLiteralCheck.cpp
  clang-tools-extra/trunk/test/clang-tidy/modernize-raw-string-literal.cpp

Index: clang-tools-extra/trunk/clang-tidy/modernize/RawStringLiteralCheck.cpp
===================================================================
--- clang-tools-extra/trunk/clang-tidy/modernize/RawStringLiteralCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/modernize/RawStringLiteralCheck.cpp
@@ -108,7 +108,8 @@
 }
 
 void RawStringLiteralCheck::registerMatchers(MatchFinder *Finder) {
-  Finder->addMatcher(stringLiteral().bind("lit"), this);
+  Finder->addMatcher(
+      stringLiteral(unless(hasParent(predefinedExpr()))).bind("lit"), this);
 }
 
 void RawStringLiteralCheck::check(const MatchFinder::MatchResult &Result) {
Index: clang-tools-extra/trunk/test/clang-tidy/modernize-raw-string-literal.cpp
===================================================================
--- clang-tools-extra/trunk/test/clang-tidy/modernize-raw-string-literal.cpp
+++ clang-tools-extra/trunk/test/clang-tidy/modernize-raw-string-literal.cpp
@@ -91,6 +91,10 @@
 // CHECK-MESSAGES: :[[@LINE-1]]:32: warning: {{.*}} can be written as a raw string literal
 // CHECK-FIXES: {{^}}char const *const HexPrintable(R"(@\)");{{$}}
 
+char const *const prettyFunction(__PRETTY_FUNCTION__);
+char const *const function(__FUNCTION__);
+char const *const func(__func__);
+
 #define TRICK(arg_) #arg_
 char const *const MacroBody = TRICK(foo\\bar);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19331.54504.patch
Type: text/x-patch
Size: 1327 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160421/0e7625b0/attachment.bin>


More information about the cfe-commits mailing list