Fix handling of CHECK-DAG inside of CHECK-LABEL.
authorRafael Espindola <rafael.espindola@gmail.com>
Fri, 11 Oct 2013 16:48:02 +0000 (16:48 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Fri, 11 Oct 2013 16:48:02 +0000 (16:48 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192463 91177308-0d34-0410-b5e6-96231b3b80d8

test/FileCheck/check-label-dag.txt [new file with mode: 0644]
utils/FileCheck/FileCheck.cpp

diff --git a/test/FileCheck/check-label-dag.txt b/test/FileCheck/check-label-dag.txt
new file mode 100644 (file)
index 0000000..2f54c3e
--- /dev/null
@@ -0,0 +1,11 @@
+; RUN: not FileCheck -input-file %s %s 2>&1 | FileCheck --check-prefix=ERROR %s
+
+bar
+zed
+
+CHECK-LABEL: {{^}}bar
+CHECK-DAG: {{^}}foo
+CHECK-LABEL: {{^}}zed
+
+ERROR: error: expected string not found in input
+ERROR-NEXT: CHECK-DAG: {{.....}}foo
index 120fdd7283b218eb54b29c0a395ec7db0fd7e032..37a1a2f5dab8b4c78b3aa5455eda06b652681a33 100644 (file)
@@ -879,12 +879,10 @@ size_t CheckString::Check(const SourceMgr &SM, StringRef Buffer,
   size_t LastPos = 0;
   std::vector<const Pattern *> NotStrings;
 
-  if (CheckTy != Check::CheckLabel) {
-    // Match "dag strings" (with mixed "not strings" if any).
-    LastPos = CheckDag(SM, Buffer, NotStrings, VariableTable);
-    if (LastPos == StringRef::npos)
-      return StringRef::npos;
-  }
+  // Match "dag strings" (with mixed "not strings" if any).
+  LastPos = CheckDag(SM, Buffer, NotStrings, VariableTable);
+  if (LastPos == StringRef::npos)
+    return StringRef::npos;
 
   // Match itself from the last position after matching CHECK-DAG.
   StringRef MatchBuffer = Buffer.substr(LastPos);