aboutsummaryrefslogtreecommitdiff
path: root/llvm/utils/FileCheck/FileCheck.cpp
diff options
context:
space:
mode:
authorDaniel Sanders <daniel.sanders@imgtec.com>2013-11-20 13:25:05 +0000
committerDaniel Sanders <daniel.sanders@imgtec.com>2013-11-20 13:25:05 +0000
commit43b5f572fa8d3107c00123046518bb4562181022 (patch)
treedd63142746690d2b7bf2b54bd9b5e62c316ae16a /llvm/utils/FileCheck/FileCheck.cpp
parenta5997c4e4aea266b395fa8ac1df46a02a57f45c4 (diff)
downloadllvm-43b5f572fa8d3107c00123046518bb4562181022.zip
llvm-43b5f572fa8d3107c00123046518bb4562181022.tar.gz
llvm-43b5f572fa8d3107c00123046518bb4562181022.tar.bz2
FileCheck: fix a bug with multiple --check-prefix options. Similar to r194565
Summary: Directives are being ignored, when they occur between a partial-word false match and any match on another prefix. For example, with FOO and BAR prefixes: _FOO FOO: foo BAR: bar FileCheck incorrectly matches: fog bar This happens because FOO falsely matched as a partial word at '_FOO' and was ignored while BAR matched at 'BAR:'. The match of BAR is incorrectly returned as the 'first match' causing the FOO directive to be discarded. Fixed this the same way as r194565 (D2166) did for a similar test case. The partial-word false match should be counted as a match for the purposes of finding the first match of a prefix, but should be returned as a false match using CheckTy::CheckNone so that it isn't treated as a directive. Fixes PR17995 Reviewers: samsonov, arsenm Reviewed By: samsonov CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2228 llvm-svn: 195248
Diffstat (limited to 'llvm/utils/FileCheck/FileCheck.cpp')
-rw-r--r--llvm/utils/FileCheck/FileCheck.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/utils/FileCheck/FileCheck.cpp b/llvm/utils/FileCheck/FileCheck.cpp
index f2510d7..260bd6c 100644
--- a/llvm/utils/FileCheck/FileCheck.cpp
+++ b/llvm/utils/FileCheck/FileCheck.cpp
@@ -795,10 +795,11 @@ static StringRef FindFirstCandidateMatch(StringRef &Buffer,
// it. This should also prevent matching the wrong prefix when one is a
// substring of another.
if (PrefixLoc != 0 && IsPartOfWord(Buffer[PrefixLoc - 1]))
- continue;
+ FirstTy = Check::CheckNone;
+ else
+ FirstTy = FindCheckType(Rest, Prefix);
FirstLoc = PrefixLoc;
- FirstTy = FindCheckType(Rest, Prefix);
FirstPrefix = Prefix;
}