[PATCH] Add support to FileCheck for out-of-order matching
Eli Bendersky
eliben at google.com
Wed Apr 10 14:28:20 PDT 2013
On Wed, Apr 10, 2013 at 2:20 PM, Reid Kleckner <rnk at google.com> wrote:
> I was thinking more like this could succeed:
> ; CHECK: foo
> ; CHECK-ANYWHERE: bar
> ; CHECK-NEXT: baz
>
> bar <- second
> baz <- third
> foo <- first match
>
> The goal being to handle something like the vtable layout tests, which
> would look like:
>
> // RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm-only
> -fdump-vtable-layouts |& FileCheck %s
> ...
> namespace Test1 {
> // CHECK-ANYWHERE: Vtable for 'Test1::A' (3 entries).
> // CHECK-NEXT: 0 | offset_to_top (0)
> // CHECK-NEXT: 1 | Test1::A RTTI
> // CHECK-NEXT: -- (Test1::A, 0) vtable address --
> // CHECK-NEXT: 2 | void Test1::A::f()
> struct A {
> virtual void f();
> };
> void A::f() { }
> }
>
> Instead of the current repeated FileChecks with prefixes:
>
> // RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm-only
> -fdump-vtable-layouts > %t 2>&1
> // RUN: FileCheck --check-prefix=CHECK-1 %s < %t
> // RUN: FileCheck --check-prefix=CHECK-2 %s < %t
> ...
> // CHECK-1: Vtable for 'Test1::A' (3 entries).
> // CHECK-1-NEXT: 0 | offset_to_top (0)
> // CHECK-1-NEXT: 1 | Test1::A RTTI
> // CHECK-1-NEXT: -- (Test1::A, 0) vtable address --
> // CHECK-1-NEXT: 2 | void Test1::A::f()
>
>
I see. You can still associate all NEXTs with the previous match even if
it's ANYWHERE. This doesn't require you to reset the line, though, if you
follow the suggestion I outlined. Or you could prohibit CHECK and
CHECK-ANYWHERE in the same test file (they can coexist with different
prefixes). Otherwise, I think the interaction between them is just a means
to create undecipherable tests.
Eli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130410/0cd88074/attachment.html>
More information about the llvm-commits
mailing list