diff --git a/test/FileCheck/check-multiple-prefixes-nomatch-2.txt b/test/FileCheck/check-multiple-prefixes-nomatch-2.txt new file mode 100644 index 00000000000..a1dc3d87b01 --- /dev/null +++ b/test/FileCheck/check-multiple-prefixes-nomatch-2.txt @@ -0,0 +1,10 @@ +; RUN: not FileCheck -input-file %s %s -check-prefix=FOO -check-prefix=BAR 2>&1 | FileCheck %s + +fog +bar +; _FOO not a valid check-line +; FOO: fo{{o}} +; BAR: ba{{r}} + +; CHECK: {{error: expected string not found in input}} +; CHECK-NEXT: {{F}}OO: fo{{[{][{]o[}][}]}} diff --git a/utils/FileCheck/FileCheck.cpp b/utils/FileCheck/FileCheck.cpp index f2510d7dfd7..260bd6ce2d4 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; }