[PATCH] D102770: [clang-tidy] Fix a crash for raw-string-literal check.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 20 00:17:12 PDT 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rG775ca3a89cba: [clang-tidy] Fix a crash for raw-string-literal check. (authored by hokein).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102770

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


Index: clang-tools-extra/clang-tidy/modernize/RawStringLiteralCheck.cpp
===================================================================
--- clang-tools-extra/clang-tidy/modernize/RawStringLiteralCheck.cpp
+++ clang-tools-extra/clang-tidy/modernize/RawStringLiteralCheck.cpp
@@ -56,7 +56,7 @@
       *Result.SourceManager, Result.Context->getLangOpts());
   StringRef Text = Lexer::getSourceText(CharRange, *Result.SourceManager,
                                         Result.Context->getLangOpts());
-  if (isRawStringLiteral(Text))
+  if (Text.empty() || isRawStringLiteral(Text))
     return false;
 
   return containsEscapes(Text, R"('\"?x01)");


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102770.346641.patch
Type: text/x-patch
Size: 656 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210520/10aa0ae1/attachment-0001.bin>


More information about the cfe-commits mailing list