================
@@ -90,16 +90,25 @@ class StandardDirective : public Directive {
StandardDirective(SourceLocation DirectiveLoc, SourceLocation DiagnosticLoc,
StringRef Spelling, bool MatchAnyFileAndLine,
bool MatchAnyLine, StringRef Text, unsigned Min,
- unsigned Max)
+ unsigned Max, bool FullMatchRequired)
: Directive(DirectiveLoc, DiagnosticLoc, Spelling, MatchAnyFileAndLine,
- MatchAnyLine, Text, Min, Max) {}
+ MatchAnyLine, Text, Min, Max, FullMatchRequired) {}
bool isValid(std::string &Error) override {
// all strings are considered valid; even empty ones
return true;
}
- bool match(StringRef S) override { return S.contains(Text); }
+ DiagnosticMatchResult match(StringRef S) const override {
+ if (!S.contains(Text)) {
+ return DiagnosticMatchResult::NoMatch;
+ }
+ if (!FullMatchRequired) {
----------------
AaronBallman wrote:
This surprised me; it means the API returns "this is a full match" when it's
not a full match at all. I kind of would have expected this API to skip this
part and do the actual test against the text (but I understand why you want to
skip that effort if a full match isn't required in the first place).
https://github.com/llvm/llvm-project/pull/179835
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits