From 46db030188e562c02a3ef2bb83360691bad26caf Mon Sep 17 00:00:00 2001 From: Marek Kurdej Date: Wed, 5 Jan 2022 13:39:08 +0100 Subject: [PATCH] [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 --- clang/lib/Format/Format.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 RawStringMatches; std::string RawStringTermination = ")\"";