summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/VerifyDiagnosticConsumer.cpp
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2013-12-12 00:27:31 +0000
committerHans Wennborg <hans@hanshq.net>2013-12-12 00:27:31 +0000
commite6a877518368174ea3c56016e16ed03dbf15a2e8 (patch)
tree8a5123b41a27a9ab83c1effcf345a15aaa76739b /clang/lib/Frontend/VerifyDiagnosticConsumer.cpp
parentfa50630e43e5d708deaeb01fb9b7e3cdffcfa524 (diff)
downloadbcm5719-llvm-e6a877518368174ea3c56016e16ed03dbf15a2e8.tar.gz
bcm5719-llvm-e6a877518368174ea3c56016e16ed03dbf15a2e8.zip
Use llvm::Regex::Escape in VerifyDiagnosticConsumer.cpp
This depends on LLVM r197096. llvm-svn: 197101
Diffstat (limited to 'clang/lib/Frontend/VerifyDiagnosticConsumer.cpp')
-rw-r--r--clang/lib/Frontend/VerifyDiagnosticConsumer.cpp32
1 files changed, 1 insertions, 31 deletions
diff --git a/clang/lib/Frontend/VerifyDiagnosticConsumer.cpp b/clang/lib/Frontend/VerifyDiagnosticConsumer.cpp
index b53fde257de..40992fec3f6 100644
--- a/clang/lib/Frontend/VerifyDiagnosticConsumer.cpp
+++ b/clang/lib/Frontend/VerifyDiagnosticConsumer.cpp
@@ -851,36 +851,6 @@ void VerifyDiagnosticConsumer::CheckDiagnostics() {
ED.Notes.clear();
}
-// Add the characters from FixedStr to RegexStr, escaping as needed. This
-// avoids the need for backslash-escaping in common patterns.
-static void AddFixedStringToRegEx(StringRef FixedStr, std::string &RegexStr) {
- // FIXME: Expose FileCheck.cpp's Pattern::AddFixedStringToRegEx as a utility
- // method in RegEx.
-
- for (unsigned i = 0, e = FixedStr.size(); i != e; ++i) {
- switch (FixedStr[i]) {
- // These are the special characters matched in "p_ere_exp".
- case '(':
- case ')':
- case '^':
- case '$':
- case '|':
- case '*':
- case '+':
- case '?':
- case '.':
- case '[':
- case '\\':
- case '{':
- RegexStr += '\\';
- // FALL THROUGH.
- default:
- RegexStr += FixedStr[i];
- break;
- }
- }
-}
-
Directive *Directive::create(bool RegexKind, SourceLocation DirectiveLoc,
SourceLocation DiagnosticLoc, StringRef Text,
unsigned Min, unsigned Max) {
@@ -905,7 +875,7 @@ Directive *Directive::create(bool RegexKind, SourceLocation DirectiveLoc,
if (VerbatimMatchLength == StringRef::npos)
VerbatimMatchLength = S.size();
// Escape and append the fixed string.
- AddFixedStringToRegEx(S.substr(0, VerbatimMatchLength), RegexStr);
+ RegexStr += llvm::Regex::escape(S.substr(0, VerbatimMatchLength));
S = S.drop_front(VerbatimMatchLength);
}
}
OpenPOWER on IntegriCloud