1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

[FileCheck] Fix --strict-whitespace --match-full-lines

Make sure FileCheck --strict-whitespace --match-full-lines translates
'CHECK: bla ' into pattern '^ bla $' instead of pattern '^bla$'.

llvm-svn: 290069
This commit is contained in:
Tom de Vries 2016-12-18 20:45:59 +00:00
parent 5bc3acc382
commit c34203accd

View File

@ -168,10 +168,11 @@ bool Pattern::ParsePattern(StringRef PatternStr, StringRef Prefix,
this->LineNumber = LineNumber;
PatternLoc = SMLoc::getFromPointer(PatternStr.data());
// Ignore trailing whitespace.
while (!PatternStr.empty() &&
(PatternStr.back() == ' ' || PatternStr.back() == '\t'))
PatternStr = PatternStr.substr(0, PatternStr.size() - 1);
if (!(NoCanonicalizeWhiteSpace && MatchFullLines))
// Ignore trailing whitespace.
while (!PatternStr.empty() &&
(PatternStr.back() == ' ' || PatternStr.back() == '\t'))
PatternStr = PatternStr.substr(0, PatternStr.size() - 1);
// Check that there is something on the line.
if (PatternStr.empty()) {
@ -866,7 +867,8 @@ static bool ReadCheckFile(SourceMgr &SM, StringRef Buffer, Regex &PrefixRE,
// Okay, we found the prefix, yay. Remember the rest of the line, but ignore
// leading whitespace.
Buffer = Buffer.substr(Buffer.find_first_not_of(" \t"));
if (!(NoCanonicalizeWhiteSpace && MatchFullLines))
Buffer = Buffer.substr(Buffer.find_first_not_of(" \t"));
// Scan ahead to the end of line.
size_t EOL = Buffer.find_first_of("\n\r");