@@ -2906,23 +2906,29 @@ impl<'test> TestCx<'test> {
2906
2906
fn verify_with_filecheck ( & self , output : & Path ) -> ProcRes {
2907
2907
let mut filecheck = Command :: new ( self . config . llvm_filecheck . as_ref ( ) . unwrap ( ) ) ;
2908
2908
filecheck. arg ( "--input-file" ) . arg ( output) . arg ( & self . testpaths . file ) ;
2909
+
2909
2910
// It would be more appropriate to make most of the arguments configurable through
2910
2911
// a comment-attribute similar to `compile-flags`. For example, --check-prefixes is a very
2911
2912
// useful flag.
2912
2913
//
2913
2914
// For now, though…
2914
- let prefix_for_target =
2915
- if self . config . target . contains ( "msvc" ) { "MSVC" } else { "NONMSVC" } ;
2916
- let prefixes = if let Some ( rev) = self . revision {
2917
- format ! ( "CHECK,{},{}" , prefix_for_target, rev)
2918
- } else {
2919
- format ! ( "CHECK,{}" , prefix_for_target)
2920
- } ;
2921
- if self . config . llvm_version . unwrap_or ( 0 ) >= 130000 {
2922
- filecheck. args ( & [ "--allow-unused-prefixes" , "--check-prefixes" , & prefixes] ) ;
2923
- } else {
2924
- filecheck. args ( & [ "--check-prefixes" , & prefixes] ) ;
2915
+
2916
+ // Because we use custom prefixes, we also have to register the default prefix.
2917
+ filecheck. arg ( "--check-prefix=CHECK" ) ;
2918
+
2919
+ // Some tests use the current revision name as a check prefix.
2920
+ if let Some ( rev) = self . revision {
2921
+ filecheck. arg ( "--check-prefix" ) . arg ( rev) ;
2925
2922
}
2923
+
2924
+ // Some tests also expect either the MSVC or NONMSVC prefix to be defined.
2925
+ let msvc_or_not = if self . config . target . contains ( "msvc" ) { "MSVC" } else { "NONMSVC" } ;
2926
+ filecheck. arg ( "--check-prefix" ) . arg ( msvc_or_not) ;
2927
+
2928
+ // The filecheck tool normally fails if a prefix is defined but not used.
2929
+ // However, we define several prefixes globally for all tests.
2930
+ filecheck. arg ( "--allow-unused-prefixes" ) ;
2931
+
2926
2932
// Provide more context on failures.
2927
2933
filecheck. args ( & [ "--dump-input-context" , "100" ] ) ;
2928
2934
self . compose_and_run ( filecheck, "" , None , None )
0 commit comments