[clang][NFC] Make various uses of Regex const
The const-correctness of match() was fixed in rL372764, which allows
uses of Regex objects to be const in cases they couldn't be before. This
patch tightens up the const-ness of Regex in various such cases.
Reviewers: thopre
Reviewed By: thopre
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D68155
diff --git a/clang/tools/clang-refactor/TestSupport.cpp b/clang/tools/clang-refactor/TestSupport.cpp
index 9d2d966..cfe9c0c 100644
--- a/clang/tools/clang-refactor/TestSupport.cpp
+++ b/clang/tools/clang-refactor/TestSupport.cpp
@@ -303,9 +303,10 @@
// See the doc comment for this function for the explanation of this
// syntax.
- static Regex RangeRegex("range[[:blank:]]*([[:alpha:]_]*)?[[:blank:]]*=[[:"
- "blank:]]*(\\+[[:digit:]]+)?[[:blank:]]*(->[[:blank:]"
- "]*[\\+\\:[:digit:]]+)?");
+ static const Regex RangeRegex(
+ "range[[:blank:]]*([[:alpha:]_]*)?[[:blank:]]*=[[:"
+ "blank:]]*(\\+[[:digit:]]+)?[[:blank:]]*(->[[:blank:]"
+ "]*[\\+\\:[:digit:]]+)?");
std::map<std::string, SmallVector<TestSelectionRange, 8>> GroupedRanges;
@@ -352,7 +353,7 @@
unsigned EndOffset;
if (!Matches[3].empty()) {
- static Regex EndLocRegex(
+ static const Regex EndLocRegex(
"->[[:blank:]]*(\\+[[:digit:]]+):([[:digit:]]+)");
SmallVector<StringRef, 4> EndLocMatches;
if (!EndLocRegex.match(Matches[3], &EndLocMatches)) {