Skip to content

Commit

Permalink
FileCheck: Fix off-by-one bug that made CHECK-NOT: ignore the next ch…
Browse files Browse the repository at this point in the history
…aracter after the colon.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164165 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
d0k committed Sep 18, 2012
1 parent 51ca601 commit 30ce40e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
9 changes: 9 additions & 0 deletions test/Other/FileCheck-space.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
RUN: printf "a\nb" | FileCheck %s -check-prefix=TEST1
RUN: echo oo | FileCheck %s -check-prefix=TEST2

Check that CHECK-NEXT without a space after the colon works.
TEST1:a
TEST1-NEXT:b

Check that CHECK-NOT without a space after the colon works.
TEST2-NOT:foo
2 changes: 1 addition & 1 deletion test/Other/lit.local.cfg
Original file line number Diff line number Diff line change
@@ -1 +1 @@
config.suffixes = ['.ll', '.c', '.cpp']
config.suffixes = ['.ll', '.c', '.cpp', '.txt']
4 changes: 2 additions & 2 deletions utils/FileCheck/FileCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,11 +537,11 @@ static bool ReadCheckFile(SourceMgr &SM,
Buffer = Buffer.substr(CheckPrefix.size()+1);
} else if (Buffer.size() > CheckPrefix.size()+6 &&
memcmp(Buffer.data()+CheckPrefix.size(), "-NEXT:", 6) == 0) {
Buffer = Buffer.substr(CheckPrefix.size()+7);
Buffer = Buffer.substr(CheckPrefix.size()+6);
IsCheckNext = true;
} else if (Buffer.size() > CheckPrefix.size()+5 &&
memcmp(Buffer.data()+CheckPrefix.size(), "-NOT:", 5) == 0) {
Buffer = Buffer.substr(CheckPrefix.size()+6);
Buffer = Buffer.substr(CheckPrefix.size()+5);
IsCheckNot = true;
} else {
Buffer = Buffer.substr(1);
Expand Down

0 comments on commit 30ce40e

Please sign in to comment.