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

Marek via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 20 13:09:17 PDT 2016


edyp87 removed rL LLVM as the repository for this revision.
edyp87 updated this revision to Diff 54401.
edyp87 added a comment.

Extended diff range + removed unnecessary variable.


http://reviews.llvm.org/D19331

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

Index: test/clang-tidy/modernize-raw-string-literal.cpp
===================================================================
--- test/clang-tidy/modernize-raw-string-literal.cpp
+++ 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);
 
Index: clang-tidy/modernize/RawStringLiteralCheck.cpp
===================================================================
--- clang-tidy/modernize/RawStringLiteralCheck.cpp
+++ clang-tidy/modernize/RawStringLiteralCheck.cpp
@@ -108,7 +108,10 @@
 }
 
 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) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19331.54401.patch
Type: text/x-patch
Size: 1189 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160420/365e90a5/attachment-0001.bin>


More information about the cfe-commits mailing list