[PATCH] D16529: [clang-tidy] Add modernize-raw-string-literal check
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 1 07:28:21 PST 2016
aaron.ballman added inline comments.
================
Comment at: clang-tidy/modernize/RawStringLiteralCheck.cpp:80
@@ +79,3 @@
+ return false;
+
+ const size_t NewLinePos = Text.find(R"(\n)");
----------------
This is why I would still prefer to block on fixing StringLiteral. This is functional, but really kind of nasty -- in the common case (not already a raw string literal), this does two linear searches through the entire string literal.
================
Comment at: clang-tidy/modernize/RawStringLiteralCheck.cpp:88
@@ +87,3 @@
+}
+
+bool containsDelimiter(StringRef Bytes, const std::string &Delimiter) {
----------------
I think Alex's point is: why not R"('\"?x01)" (removing the need for lit)?
================
Comment at: clang-tidy/modernize/RawStringLiteralCheck.cpp:116
@@ +115,3 @@
+ if (containsEscapedCharacters(Result, Literal))
+ replaceWithRawStringLiteral(Result, Literal);
+ }
----------------
A configuration option makes sense to me, but I would be fine if it was a follow-on patch. I think that someone running this check is likely fine with the level of noise it will produce (which should be moderately low).
http://reviews.llvm.org/D16529
More information about the cfe-commits
mailing list