@@ -1958,23 +1958,36 @@ impl<'test> TestCx<'test> {
19581958 let mut filecheck = Command :: new ( self . config . llvm_filecheck . as_ref ( ) . unwrap ( ) ) ;
19591959 filecheck. arg ( "--input-file" ) . arg ( output) . arg ( & self . testpaths . file ) ;
19601960
1961- // FIXME: Consider making some of these prefix flags opt-in per test,
1962- // via `filecheck-flags` or by adding new header directives.
1963-
19641961 // Because we use custom prefixes, we also have to register the default prefix.
19651962 filecheck. arg ( "--check-prefix=CHECK" ) ;
19661963
1967- // Some tests use the current revision name as a check prefix.
1964+ // FIXME(jieyouxu): the current scheme of conflating `compiletest` revisions with
1965+ // `FileCheck` prefixes is questionable. The current scheme means that `compiletest`
1966+ // revision names **implicitly** registers a `FileCheck` prefix of the same name. But this
1967+ // is questionable: with this setup, there is no way to distinguish whether the test writer
1968+ // wants to:
1969+ //
1970+ // 1. Use revisions but ONLY for compiletest directive purposes. E.g. `FileCheck`
1971+ // annotations should ONLY be using the default `CHECK` prefix.
1972+ // 2. Use revisions but ONLY for filecheck prefix purposes. This use case is somewhat
1973+ // questionable; previously we implicitly injected `MSVC` for msvc host and `NONMSVC` for
1974+ // non-msvc host, but that is problematic in cross-compile test scenarios.
1975+ // 3. Use revisions for BOTH. This conflates `compiletest` directives (e.g. conditional test
1976+ // execution) and `FileCheck` directives, and tthet test writer can't really separate
1977+ // them.
1978+ //
1979+ // A better solution might be to split these probably-orthogonal concepts, and use a
1980+ // dedicated directive like `//@ filecheck-prefixes: MSVC NONMSVC` to not conflate
1981+ // `compiletest` directives with `FileCheck` prefixes.
1982+
1983+ // HACK: tests are allowed to use a revision name as a check prefix.
19681984 if let Some ( rev) = self . revision {
19691985 filecheck. arg ( "--check-prefix" ) . arg ( rev) ;
19701986 }
19711987
1972- // Some tests also expect either the MSVC or NONMSVC prefix to be defined.
1973- let msvc_or_not = if self . config . target . contains ( "msvc" ) { "MSVC" } else { "NONMSVC" } ;
1974- filecheck. arg ( "--check-prefix" ) . arg ( msvc_or_not) ;
1975-
1976- // The filecheck tool normally fails if a prefix is defined but not used.
1977- // However, we define several prefixes globally for all tests.
1988+ // HACK: the filecheck tool normally fails if a prefix is defined but not used. However,
1989+ // sometimes revisions are used to specify *compiletest* directives which are not FileCheck
1990+ // concerns.
19781991 filecheck. arg ( "--allow-unused-prefixes" ) ;
19791992
19801993 // Provide more context on failures.
0 commit comments