diff options
author | Tom de Vries <vries@codesourcery.com> | 2016-12-18 20:45:59 +0000 |
---|---|---|
committer | Tom de Vries <vries@codesourcery.com> | 2016-12-18 20:45:59 +0000 |
commit | 1714676ae0b342663173f5625853f1461a4efb65 (patch) | |
tree | 68eb795b4d970d0892f7b3bab04c3bfdf42d0e09 /llvm/utils/FileCheck/FileCheck.cpp | |
parent | b7477b540eef8375ff36066df84fca75b65c7279 (diff) | |
download | llvm-1714676ae0b342663173f5625853f1461a4efb65.zip llvm-1714676ae0b342663173f5625853f1461a4efb65.tar.gz llvm-1714676ae0b342663173f5625853f1461a4efb65.tar.bz2 |
[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
Diffstat (limited to 'llvm/utils/FileCheck/FileCheck.cpp')
-rw-r--r-- | llvm/utils/FileCheck/FileCheck.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/llvm/utils/FileCheck/FileCheck.cpp b/llvm/utils/FileCheck/FileCheck.cpp index 2d97477..9e17757 100644 --- a/llvm/utils/FileCheck/FileCheck.cpp +++ b/llvm/utils/FileCheck/FileCheck.cpp @@ -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"); |