[PATCH] Allow multiple check prefixes in FileCheck

Matt Arsenault Matthew.Arsenault at amd.com
Mon Oct 7 12:13:49 PDT 2013



================
Comment at: test/FileCheck/check-dag-substring-prefix.txt:1-7
@@ +1,7 @@
+; RUN: FileCheck -check-prefix=A -check-prefix=AA -input-file %s %s
+
+this is the string to be matched
+this should also be matched
+
+; BAA-DAG: this is the string to be {{matched}}
+; BAA-DAG: this should also be {{matched}}
----------------
Daniel Sanders wrote:
> I don't think test/FileCheck/check-dag-substring-prefix.txt should pass as it currently is. I think it should fail with the 'no check strings found' error. The second RUN line of test/FileCheck/check-prefixes.txt checks that this happens for single prefixes.
This is missing the not so it's checking the opposite of what it's supposed to

================
Comment at: utils/FileCheck/FileCheck.cpp:1182
@@ +1181,3 @@
+static bool ValidateCheckPrefixes() {
+  StringSet<> PrefixSet;
+
----------------
Daniel Sanders wrote:
> What is this variable for? I can only see strings being added to it. There doesn't seem to be anything reading from this variable.
It makes sure you don't specify the same prefix multiple times. It's read from when it checks if the insert succeeds.

================
Comment at: utils/FileCheck/FileCheck.cpp:930-936
@@ -816,7 +929,9 @@
+  // prefix as a filler for the error message.
   if (!DagNotMatches.empty()) {
     CheckStrings.push_back(CheckString(Pattern(Check::CheckEOF),
+                                       CheckPrefixes[0],
                                        SMLoc::getFromPointer(Buffer.data()),
                                        Check::CheckEOF));
     std::swap(DagNotMatches, CheckStrings.back().DagNotStrings);
   }
 
----------------
Daniel Sanders wrote:
> This if-statement is making CheckStrings non-empty which inhibits the 'no check strings found' even when no check-strings are found.
No, this isn't a problem since If DagNotMatches is not empty, then CheckStrings is also not empty.


http://llvm-reviews.chandlerc.com/D1374



More information about the llvm-commits mailing list