summaryrefslogtreecommitdiff
path: root/utils/FileCheck
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
commite4e260e6a7324f3274c812b042d6706499727daf (patch)
tree9735d7a49ea26215b5e8b42aafe65b9cabd1a3c2 /utils/FileCheck
parent7a8d0d7ff7553d23185f0769afcf2999ae3d67bf (diff)
downloadllvm-e4e260e6a7324f3274c812b042d6706499727daf.tar.gz
llvm-e4e260e6a7324f3274c812b042d6706499727daf.tar.bz2
llvm-e4e260e6a7324f3274c812b042d6706499727daf.tar.xz
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195248 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/FileCheck')
-rw-r--r--utils/FileCheck/FileCheck.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/utils/FileCheck/FileCheck.cpp b/utils/FileCheck/FileCheck.cpp
index f2510d7dfd..260bd6ce2d 100644
--- a/utils/FileCheck/FileCheck.cpp
+++ b/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;
}