diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2017-06-07 12:06:45 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2017-06-07 12:06:45 +0000 |
commit | cf60ab313a33b5e6a480311a9d5d2765b03c384d (patch) | |
tree | 082379b70c55ae9f931758dc24a56aa77a998561 | |
parent | 0527c32be86c40c4589e7d5402555074d121ffd6 (diff) | |
download | bcm5719-llvm-cf60ab313a33b5e6a480311a9d5d2765b03c384d.tar.gz bcm5719-llvm-cf60ab313a33b5e6a480311a9d5d2765b03c384d.zip |
[FileCheck] Don't scan past the closing CHECK-DAG for CHECK-NOT inside CHECK-DAG
If there's enough data in fron of it the skipped region would just
become arbitrarily large, and we scan for the CHECK-NOT everywhere.
llvm-svn: 304900
-rw-r--r-- | llvm/test/FileCheck/check-dag.txt | 9 | ||||
-rw-r--r-- | llvm/utils/FileCheck/FileCheck.cpp | 2 |
2 files changed, 10 insertions, 1 deletions
diff --git a/llvm/test/FileCheck/check-dag.txt b/llvm/test/FileCheck/check-dag.txt index 2b5a47551e8..7c5a1d18292 100644 --- a/llvm/test/FileCheck/check-dag.txt +++ b/llvm/test/FileCheck/check-dag.txt @@ -12,6 +12,10 @@ add r11, r3, r4 add r10, r1, r2 mul r5, r10, r11 +# begin +# end +xor + ; CHECK-DAG: add [[REG1:r[0-9]+]], r1, r2 ; CHECK-DAG: add [[REG2:r[0-9]+]], r3, r4 ; CHECK: mul r5, [[REG1]], [[REG2]] @@ -24,3 +28,8 @@ mul r5, r10, r11 ; CHECK-DAG: add [[REG2:r[0-9]+]], r3, r4 ; CHECK-NOT: xor ; CHECK-DAG: mul r5, [[REG1]], [[REG2]] + +; CHECK-DAG: begin +; CHECK-NOT: xor +; CHECK-DAG: end +; CHECK: xor diff --git a/llvm/utils/FileCheck/FileCheck.cpp b/llvm/utils/FileCheck/FileCheck.cpp index f563cadc92c..9d808cc875c 100644 --- a/llvm/utils/FileCheck/FileCheck.cpp +++ b/llvm/utils/FileCheck/FileCheck.cpp @@ -1203,7 +1203,7 @@ size_t CheckString::CheckDag(const SourceMgr &SM, StringRef Buffer, // If there's CHECK-NOTs between two CHECK-DAGs or from CHECK to // CHECK-DAG, verify that there's no 'not' strings occurred in that // region. - StringRef SkippedRegion = Buffer.substr(LastPos, MatchPos); + StringRef SkippedRegion = Buffer.slice(LastPos, MatchPos); if (CheckNot(SM, SkippedRegion, NotStrings, VariableTable)) return StringRef::npos; // Clear "not strings". |