[llvm] r290069 - [FileCheck] Fix --strict-whitespace --match-full-lines
Tom de Vries via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 18 12:45:59 PST 2016
Author: vries
Date: Sun Dec 18 14:45:59 2016
New Revision: 290069
URL: http://llvm.org/viewvc/llvm-project?rev=290069&view=rev
Log:
[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$'.
Modified:
llvm/trunk/utils/FileCheck/FileCheck.cpp
Modified: llvm/trunk/utils/FileCheck/FileCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/FileCheck/FileCheck.cpp?rev=290069&r1=290068&r2=290069&view=diff
==============================================================================
--- llvm/trunk/utils/FileCheck/FileCheck.cpp (original)
+++ llvm/trunk/utils/FileCheck/FileCheck.cpp Sun Dec 18 14:45:59 2016
@@ -168,10 +168,11 @@ bool Pattern::ParsePattern(StringRef Pat
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,
// 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");
More information about the llvm-commits
mailing list