[clang-format] Simplify raw string regex. NFC.
authorMarek Kurdej <marek.kurdej+llvm.org@gmail.com>
Wed, 5 Jan 2022 12:39:08 +0000 (13:39 +0100)
committerMarek Kurdej <marek.kurdej+llvm.org@gmail.com>
Wed, 5 Jan 2022 12:39:28 +0000 (13:39 +0100)
Introduced in https://reviews.llvm.org/D115168.

Reviewed By: MyDeveloperDay, HazardyKnusperkeks

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

clang/lib/Format/Format.cpp

index a4ce8a2..d1bc378 100644 (file)
@@ -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 = ")\"";