|
@@ -320,6 +320,7 @@ bool FileCheckPattern::parsePattern(StringRef PatternStr, StringRef Prefix,
|
|
SourceMgr &SM,
|
|
SourceMgr &SM,
|
|
const FileCheckRequest &Req) {
|
|
const FileCheckRequest &Req) {
|
|
bool MatchFullLinesHere = Req.MatchFullLines && CheckTy != Check::CheckNot;
|
|
bool MatchFullLinesHere = Req.MatchFullLines && CheckTy != Check::CheckNot;
|
|
|
|
+ IgnoreCase = Req.IgnoreCase;
|
|
|
|
|
|
PatternLoc = SMLoc::getFromPointer(PatternStr.data());
|
|
PatternLoc = SMLoc::getFromPointer(PatternStr.data());
|
|
|
|
|
|
@@ -619,7 +620,8 @@ Expected<size_t> FileCheckPattern::match(StringRef Buffer, size_t &MatchLen,
|
|
// If this is a fixed string pattern, just match it now.
|
|
// If this is a fixed string pattern, just match it now.
|
|
if (!FixedStr.empty()) {
|
|
if (!FixedStr.empty()) {
|
|
MatchLen = FixedStr.size();
|
|
MatchLen = FixedStr.size();
|
|
- size_t Pos = Buffer.find(FixedStr);
|
|
|
|
|
|
+ size_t Pos = IgnoreCase ? Buffer.find_lower(FixedStr)
|
|
|
|
+ : Buffer.find(FixedStr);
|
|
if (Pos == StringRef::npos)
|
|
if (Pos == StringRef::npos)
|
|
return make_error<FileCheckNotFoundError>();
|
|
return make_error<FileCheckNotFoundError>();
|
|
return Pos;
|
|
return Pos;
|
|
@@ -657,7 +659,10 @@ Expected<size_t> FileCheckPattern::match(StringRef Buffer, size_t &MatchLen,
|
|
}
|
|
}
|
|
|
|
|
|
SmallVector<StringRef, 4> MatchInfo;
|
|
SmallVector<StringRef, 4> MatchInfo;
|
|
- if (!Regex(RegExToMatch, Regex::Newline).match(Buffer, &MatchInfo))
|
|
|
|
|
|
+ unsigned int Flags = Regex::Newline;
|
|
|
|
+ if (IgnoreCase)
|
|
|
|
+ Flags |= Regex::IgnoreCase;
|
|
|
|
+ if (!Regex(RegExToMatch, Flags).match(Buffer, &MatchInfo))
|
|
return make_error<FileCheckNotFoundError>();
|
|
return make_error<FileCheckNotFoundError>();
|
|
|
|
|
|
// Successful regex match.
|
|
// Successful regex match.
|