[PATCH] D16529: [clang-tidy] Add modernize-raw-string-literal check

Richard via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 10 13:18:03 PST 2016


LegalizeAdulthood added a comment.

I do not have commit access, so I will need someone to commit this for me.

Patch by Richard Thomson

thanks.


================
Comment at: clang-tidy/modernize/RawStringLiteralCheck.cpp:82
@@ +81,3 @@
+                        ? std::string{R"lit()")lit"}
+                        : (")" + Delimiter + R"(")")) != StringRef::npos;
+}
----------------
aaron.ballman wrote:
> This is a wonderful demonstration of why I hate raw string literals on shorter strings. I had to stare at that raw string for quite some time to figure it out. :-(
I used a raw string literal here because that's what this check would have recommended on this code :-).

However, your feedback is useful.  If I subsequently enhance this check with a parameter that says the minimum length a string literal must have before it is to be transformed into a raw string literal and the default value for that parameter is something like 5, would that address your concern?


http://reviews.llvm.org/D16529





More information about the cfe-commits mailing list