[PATCH] Add ALL to FileCheck

Stephen Lin swlin at post.harvard.edu
Tue Aug 13 09:11:19 PDT 2013


> Do you propose to be able to:
>
> FileCheck %s --check-prefix=FOO --check-prefix=BAR
>
> and have all three: CHECK, FOO and BAR match that line?

I propose that only match FOO and BAR. The implicit "CHECK" is
reserved only for the case where no user-specified prefix is specified
at all.

>
> So that three RUN lines would all match against CHECK, and also their own
> explicit checks?
>
> That would allow you to mix and match, ex:
>
> ; RUN: cmd1 | FileCheck %s -check-prefix=X86 --check-prefix=ARM
> ; RUN: cmd2 | FileCheck %s -check-prefix=ARM --check-prefix=MIPS
> ; RUN: cmd3 | FileCheck %s -check-prefix=ARM64 --check-prefix=MIPS64
>
> ; CHECK: ... will match all
> ; ARM: ... will match cmd1 and cmd2
> ; MIPS64: .. only matches cmd3
>
> If that's your idea, I agree Matt's implementation would be a special case
> where "CHECK" == "ALL".

I want cmd1 to match X86 and ARM, cmd2 to match ARM and MIPS, and cmd3
to match ARM64 and MIPS64, and to reserve the "CHECK" prefix to only
cases where no prefix is specified, mostly for convenience and
backward compatibility. I basically don't like the idea of any "magic
string" prefix with special meaning, but the default "CHECK" prefix is
grandfathered in.

>
> I'm not sure which case would be solved by this, and I also don't like the
> CHECK being implicit, mainly because adding new RUN lines to existing tests
> will be a lot harder (since the new FileCheck will match both old and new
> CHECKs). This is why I think that "ALL" makes sense, here.
>
> If we have ALL being the joker, than having multiple prefixes adds nothing
> to the solution. Unless you want NOT to have any implicit prefix, where this
> would happen:
>
> ; RUN: cmd1 | FileCheck %s --check-prefix=ALL -check-prefix=X86
> --check-prefix=ARM
> ; RUN: cmd2 | FileCheck %s --check-prefix=ALL -check-prefix=ARM
> --check-prefix=MIPS
> ; RUN: cmd3 | FileCheck %s -check-prefix=ARM64 --check-prefix=MIPS64
>
> ; ALL: ... matches cmd1 and cmd2
> ; ARM: ... will match cmd1 and cmd2
> ; MIPS64: .. only matches cmd3
>
> Which is more strict, but also more explicit.
>
> In my view, we should have *either* ALL, or multiple prefixes, but not both.

Exactly, my suggestion is for multiple prefixes only, and not ALL or
any other prefix that is turned on in all cases. Only "CHECK" is
grandfathered is as an implicit prefix, and it is only used in the
case that no other prefix is provided.

>
> cheers,
> --renato



More information about the llvm-commits mailing list