[PATCH] D58178: isRawStringLiteral doesn't check all erroneous cases

Goran Mitrovic via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 13 08:12:54 PST 2019


gmit updated this revision to Diff 186675.

Repository:
  rCTE Clang Tools Extra

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58178/new/

https://reviews.llvm.org/D58178

Files:
  RawStringLiteralCheck.cpp
  clang-tools-extra/tags/RELEASE_800/rc2/clang-tidy/modernize/RawStringLiteralCheck.cpp


Index: clang-tools-extra/tags/RELEASE_800/rc2/clang-tidy/modernize/RawStringLiteralCheck.cpp
===================================================================
--- clang-tools-extra/tags/RELEASE_800/rc2/clang-tidy/modernize/RawStringLiteralCheck.cpp
+++ clang-tools-extra/tags/RELEASE_800/rc2/clang-tidy/modernize/RawStringLiteralCheck.cpp
@@ -38,7 +38,8 @@
   // Already a raw string literal if R comes before ".
   const size_t QuotePos = Text.find('"');
   assert(QuotePos != StringRef::npos);
-  return (QuotePos > 0) && (Text[QuotePos - 1] == 'R');
+  return (QuotePos != StringRef::npos) && (QuotePos > 0) &&
+         (Text[QuotePos - 1] == 'R');
 }
 
 bool containsEscapedCharacters(const MatchFinder::MatchResult &Result,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58178.186675.patch
Type: text/x-patch
Size: 732 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190213/dce62546/attachment.bin>


More information about the cfe-commits mailing list