[PATCH] D16529: [clang-tidy] Add modernize-raw-string-literal check
Richard via cfe-commits
cfe-commits at lists.llvm.org
Sun Jan 31 19:41:51 PST 2016
LegalizeAdulthood marked an inline comment as done.
================
Comment at: clang-tidy/modernize/RawStringLiteralCheck.cpp:79
@@ +78,3 @@
+ if (Text.find('R') < Text.find('"'))
+ return false;
+
----------------
Take a look at http://en.cppreference.com/w/cpp/language/string_literal
There can be a prefix before the R, it's not always the first character.
================
Comment at: clang-tidy/modernize/RawStringLiteralCheck.cpp:87
@@ +86,3 @@
+ return containsEscapes(Text, R"lit('\"?x01)lit");
+}
+
----------------
Without R"()", the \ and " have to be escaped. Running this check on this code would turn this into a raw string literal.
================
Comment at: docs/clang-tidy/checks/modernize-raw-string-literal.rst:46
@@ +45,3 @@
+editor. Trailing whitespace is likely to be stripped by editors and other
+tools, changing the meaning of the literal.
+
----------------
It's a habit my fingers learned when they taught me to type on typewriters in high school.
http://reviews.llvm.org/D16529
More information about the cfe-commits
mailing list