summaryrefslogtreecommitdiff
path: root/utils/FileCheck
diff options
context:
space:
mode:
authorTom de Vries <vries@codesourcery.com>2016-12-18 20:45:59 +0000
committerTom de Vries <vries@codesourcery.com>2016-12-18 20:45:59 +0000
commit8d31c8a13ada82e5da4abbadb300f74b52fa7077 (patch)
treeb32dd3128e8d030c463a3a842fca3dd9258dbaec /utils/FileCheck
parentbd807b784e82c1f26339d45f9bf64847f42575e4 (diff)
[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$'. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290069 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/FileCheck')
-rw-r--r--utils/FileCheck/FileCheck.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/utils/FileCheck/FileCheck.cpp b/utils/FileCheck/FileCheck.cpp
index 2d9747757aa..9e177574625 100644
--- a/utils/FileCheck/FileCheck.cpp
+++ b/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");