summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/NamespaceEndCommentsFixer.cpp
diff options
context:
space:
mode:
authorThomas Preud'homme <thomasp@graphcore.ai>2019-11-19 11:18:51 +0000
committerThomas Preud'homme <thomasp@graphcore.ai>2019-11-19 16:15:21 +0000
commitb81cc6032902c810e0fde485d3092a947dc38541 (patch)
tree13748acfffc7fee11d17cf47fb5e5878519f56a6 /clang/lib/Format/NamespaceEndCommentsFixer.cpp
parent62871305c28f3102d5d06da929379674f2d40d04 (diff)
downloadbcm5719-llvm-b81cc6032902c810e0fde485d3092a947dc38541.tar.gz
bcm5719-llvm-b81cc6032902c810e0fde485d3092a947dc38541.zip
[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
Diffstat (limited to 'clang/lib/Format/NamespaceEndCommentsFixer.cpp')
-rw-r--r--clang/lib/Format/NamespaceEndCommentsFixer.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/clang/lib/Format/NamespaceEndCommentsFixer.cpp b/clang/lib/Format/NamespaceEndCommentsFixer.cpp
index 98901cff268..20b424f8607 100644
--- a/clang/lib/Format/NamespaceEndCommentsFixer.cpp
+++ b/clang/lib/Format/NamespaceEndCommentsFixer.cpp
@@ -92,24 +92,24 @@ bool validEndComment(const FormatToken *RBraceTok, StringRef NamespaceName,
// Matches a valid namespace end comment.
// Valid namespace end comments don't need to be edited.
- static llvm::Regex *const NamespaceCommentPattern =
- new llvm::Regex("^/[/*] *(end (of )?)? *(anonymous|unnamed)? *"
- "namespace( +([a-zA-Z0-9:_]+))?\\.? *(\\*/)?$",
- llvm::Regex::IgnoreCase);
- static llvm::Regex *const NamespaceMacroCommentPattern =
- new llvm::Regex("^/[/*] *(end (of )?)? *(anonymous|unnamed)? *"
- "([a-zA-Z0-9_]+)\\(([a-zA-Z0-9:_]*)\\)\\.? *(\\*/)?$",
- llvm::Regex::IgnoreCase);
+ static const llvm::Regex NamespaceCommentPattern =
+ llvm::Regex("^/[/*] *(end (of )?)? *(anonymous|unnamed)? *"
+ "namespace( +([a-zA-Z0-9:_]+))?\\.? *(\\*/)?$",
+ llvm::Regex::IgnoreCase);
+ static const llvm::Regex NamespaceMacroCommentPattern =
+ llvm::Regex("^/[/*] *(end (of )?)? *(anonymous|unnamed)? *"
+ "([a-zA-Z0-9_]+)\\(([a-zA-Z0-9:_]*)\\)\\.? *(\\*/)?$",
+ llvm::Regex::IgnoreCase);
SmallVector<StringRef, 8> Groups;
if (NamespaceTok->is(TT_NamespaceMacro) &&
- NamespaceMacroCommentPattern->match(Comment->TokenText, &Groups)) {
+ NamespaceMacroCommentPattern.match(Comment->TokenText, &Groups)) {
StringRef NamespaceTokenText = Groups.size() > 4 ? Groups[4] : "";
// The name of the macro must be used.
if (NamespaceTokenText != NamespaceTok->TokenText)
return false;
} else if (NamespaceTok->isNot(tok::kw_namespace) ||
- !NamespaceCommentPattern->match(Comment->TokenText, &Groups)) {
+ !NamespaceCommentPattern.match(Comment->TokenText, &Groups)) {
// Comment does not match regex.
return false;
}
OpenPOWER on IntegriCloud