aaron.ballman added a subscriber: aaron.ballman.

================
Comment at: clang-tidy/modernize/RawStringLiteralCheck.cpp:35
@@ +34,3 @@
+  const bool HasBackSlash = Text.find(R"(\\)") != StringRef::npos;
+  const bool HasNewLine = Text.find(R"(\n)") != StringRef::npos;
+  const bool HasQuote = Text.find(R"(\')") != StringRef::npos;
----------------
Newlines are hard. Should this also handle \r (for CRLF code like \r\n)?

================
Comment at: clang-tidy/modernize/RawStringLiteralCheck.cpp:66
@@ +65,3 @@
+void RawStringLiteralCheck::registerMatchers(MatchFinder *Finder) {
+  Finder->addMatcher(stringLiteral().bind("lit"), this);
+}
----------------
Please limit registration of the checker to just C++11 or later.

================
Comment at: test/clang-tidy/modernize-raw-string-literal.cpp:18
@@ +17,3 @@
+// CHECK-MESSAGES: :[[@LINE-1]]:27: warning: {{.*}} can be written as a raw 
string literal
+// CHECK-FIXES: {{^}}char const *const NewLine{R"(goink{{$}}
+// CHECK-FIXES-NEXT: {{^}}frob)"};{{$}}
----------------
Is there a way that this fix-it can mangle the source file in scary ways, 
though? For instance, say I have a source file saved with CRLF and a string 
literal of "foo\nbar" -- this will either make the string literal contain a 
CRLF instead of just LF, or it will make the string literal contain an LF right 
up until the user's editor saves the file and converts the line ending (I 
think).

================
Comment at: test/clang-tidy/modernize-raw-string-literal.cpp:55
@@ +54,2 @@
+// CHECK-MESSAGES: :[[@LINE-1]]:32: warning: {{.*}} can be written as a raw 
string literal
+// CHECK-FIXES: {{^}}char const *const HexPrintable{R"(@\)"};{{$}}
----------------
Can you also add a test that ensures we don't mangle already-raw string 
literals (by re-rawifying them)?


http://reviews.llvm.org/D16529



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to