diff options
author | Alexey Samsonov <samsonov@google.com> | 2013-11-13 11:56:22 +0000 |
---|---|---|
committer | Alexey Samsonov <samsonov@google.com> | 2013-11-13 11:56:22 +0000 |
commit | 21a340fa99560fb10f8ea7d87e8235a40771bc31 (patch) | |
tree | 9c3740a171eef326ae1c8722919140b9b2ffe3dc /llvm/utils/FileCheck/FileCheck.cpp | |
parent | a83c0482dda12d68c9c96ba5f504fb1b1ddcd526 (diff) | |
download | bcm5719-llvm-21a340fa99560fb10f8ea7d87e8235a40771bc31.tar.gz bcm5719-llvm-21a340fa99560fb10f8ea7d87e8235a40771bc31.zip |
FileCheck: fix a bug with multiple --check-prefix options.
Summary:
This fixes a subtle bug in new FileCheck feature added
in r194343. When we search for the first satisfying check-prefix,
we should actually return the first encounter of some check-prefix as a
substring, even if it's not a part of valid check-line. Otherwise
"FileCheck --check-prefix=FOO --check-prefix=BAR" with check file:
FOO not a vaild check-line
FOO: foo
BAR: bar
incorrectly accepted file:
fog
bar
as it skipped the first two encounters of FOO, matching only BAR: line.
Reviewers: arsenm, dsanders
Reviewed By: dsanders
CC: llvm-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D2166
llvm-svn: 194565
Diffstat (limited to 'llvm/utils/FileCheck/FileCheck.cpp')
-rw-r--r-- | llvm/utils/FileCheck/FileCheck.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/utils/FileCheck/FileCheck.cpp b/llvm/utils/FileCheck/FileCheck.cpp index c9eb8a650c8..d5f760246d6 100644 --- a/llvm/utils/FileCheck/FileCheck.cpp +++ b/llvm/utils/FileCheck/FileCheck.cpp @@ -794,12 +794,12 @@ static StringRef FindFirstCandidateMatch(StringRef &Buffer, continue; Check::CheckType Ty = FindCheckType(Rest, Prefix); - if (Ty == Check::CheckNone) - continue; FirstLoc = PrefixLoc; FirstTy = Ty; - FirstPrefix = Prefix; + // We've found the first matching check prefix. If it is invalid, we should + // continue the search after it. + FirstPrefix = (Ty == Check::CheckNone) ? "" : Prefix; } if (FirstPrefix.empty()) { |