[clang] 46db030 - [clang-format] Simplify raw string regex. NFC.

Marek Kurdej via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 5 04:39:35 PST 2022


Author: Marek Kurdej
Date: 2022-01-05T13:39:28+01:00
New Revision: 46db030188e562c02a3ef2bb83360691bad26caf

URL: https://github.com/llvm/llvm-project/commit/46db030188e562c02a3ef2bb83360691bad26caf
DIFF: https://github.com/llvm/llvm-project/commit/46db030188e562c02a3ef2bb83360691bad26caf.diff

LOG: [clang-format] Simplify raw string regex. NFC.

Introduced in https://reviews.llvm.org/D115168.

Reviewed By: MyDeveloperDay, HazardyKnusperkeks

Differential Revision: https://reviews.llvm.org/D116647

Added: 
    

Modified: 
    clang/lib/Format/Format.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index a4ce8a20a940..d1bc378766cd 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -2596,8 +2596,9 @@ tooling::Replacements sortCppIncludes(const FormatStyle &Style, StringRef Code,
   bool MainIncludeFound = false;
   bool FormattingOff = false;
 
+  // '[' must be the first and '-' the last character inside [...].
   llvm::Regex RawStringRegex(
-      "R\"(([\\[A-Za-z0-9_{}#<>%:;.?*+/^&\\$|~!=,'\\-]|])*)\\(");
+      "R\"([][A-Za-z0-9_{}#<>%:;.?*+/^&\\$|~!=,'-]*)\\(");
   SmallVector<StringRef, 2> RawStringMatches;
   std::string RawStringTermination = ")\"";
 


        


More information about the cfe-commits mailing list