diff options
author | Hans Wennborg <hans@hanshq.net> | 2013-12-14 00:46:53 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2013-12-14 00:46:53 +0000 |
commit | 9b395ef284341ee7f3525bb55f72c8b8e43a85b2 (patch) | |
tree | 73f59139554d4f31242c80e4fc2768d56f78e041 /clang/lib/Frontend/VerifyDiagnosticConsumer.cpp | |
parent | 57ae056a5c0d616ee3fd1d8136b74c2854a68a60 (diff) | |
download | bcm5719-llvm-9b395ef284341ee7f3525bb55f72c8b8e43a85b2.tar.gz bcm5719-llvm-9b395ef284341ee7f3525bb55f72c8b8e43a85b2.zip |
Don't require -re suffix on -verify directives with regexes.
Differential Revision: http://llvm-reviews.chandlerc.com/D2392
llvm-svn: 197295
Diffstat (limited to 'clang/lib/Frontend/VerifyDiagnosticConsumer.cpp')
-rw-r--r-- | clang/lib/Frontend/VerifyDiagnosticConsumer.cpp | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/clang/lib/Frontend/VerifyDiagnosticConsumer.cpp b/clang/lib/Frontend/VerifyDiagnosticConsumer.cpp index 40992fec3f6..ec45e36c713 100644 --- a/clang/lib/Frontend/VerifyDiagnosticConsumer.cpp +++ b/clang/lib/Frontend/VerifyDiagnosticConsumer.cpp @@ -356,16 +356,8 @@ static bool ParseDirective(StringRef S, ExpectedData *ED, SourceManager &SM, return true; // Default directive kind. - bool RegexKind = false; const char* KindStr = "string"; - // Next optional token: - - if (PH.Next("-re")) { - PH.Advance(); - RegexKind = true; - KindStr = "regex"; - } - // Next optional token: @ SourceLocation ExpectedLoc; if (!PH.Next("@")) { @@ -483,16 +475,8 @@ static bool ParseDirective(StringRef S, ExpectedData *ED, SourceManager &SM, if (Text.empty()) Text.assign(ContentBegin, ContentEnd); - // Check that regex directives contain at least one regex. - if (RegexKind && Text.find("{{") == StringRef::npos) { - Diags.Report(Pos.getLocWithOffset(ContentBegin-PH.Begin), - diag::err_verify_missing_regex) << Text; - return false; - } - // Construct new directive. - Directive *D = Directive::create(RegexKind, Pos, ExpectedLoc, Text, - Min, Max); + Directive *D = Directive::create(Pos, ExpectedLoc, Text, Min, Max); std::string Error; if (D->isValid(Error)) { DL->push_back(D); @@ -851,10 +835,10 @@ void VerifyDiagnosticConsumer::CheckDiagnostics() { ED.Notes.clear(); } -Directive *Directive::create(bool RegexKind, SourceLocation DirectiveLoc, +Directive *Directive::create(SourceLocation DirectiveLoc, SourceLocation DiagnosticLoc, StringRef Text, unsigned Min, unsigned Max) { - if (!RegexKind) + if (Text.find("}}") == StringRef::npos) return new StandardDirective(DirectiveLoc, DiagnosticLoc, Text, Min, Max); // Parse the directive into a regular expression. |