File tree Expand file tree Collapse file tree 3 files changed +24
-0
lines changed
src/tools/compiletest/src Expand file tree Collapse file tree 3 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -117,6 +117,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
117117 "incremental" ,
118118 "known-bug" ,
119119 "llvm-cov-flags" ,
120+ "max-llvm-major-version" ,
120121 "min-cdb-version" ,
121122 "min-gdb-version" ,
122123 "min-lldb-version" ,
Original file line number Diff line number Diff line change @@ -1546,6 +1546,20 @@ fn ignore_llvm(config: &Config, line: &str) -> IgnoreDecision {
15461546 ) ,
15471547 } ;
15481548 }
1549+ } else if let Some ( version_string) =
1550+ config. parse_name_value_directive ( line, "max-llvm-major-version" )
1551+ {
1552+ let max_version = extract_llvm_version ( & version_string) ;
1553+ // Ignore if actual major version is larger than the maximum required major version.
1554+ if actual_version. major > max_version. major {
1555+ return IgnoreDecision :: Ignore {
1556+ reason : format ! (
1557+ "ignored when the LLVM version ({actual_version}) is newer than major\
1558+ version {}",
1559+ max_version. major
1560+ ) ,
1561+ } ;
1562+ }
15491563 } else if let Some ( version_string) =
15501564 config. parse_name_value_directive ( line, "min-system-llvm-version" )
15511565 {
Original file line number Diff line number Diff line change @@ -266,6 +266,15 @@ fn llvm_version() {
266266
267267 let config: Config = cfg ( ) . llvm_version ( "10.0.0" ) . build ( ) ;
268268 assert ! ( !check_ignore( & config, "//@ min-llvm-version: 9.0" ) ) ;
269+
270+ let config: Config = cfg ( ) . llvm_version ( "19.0.0" ) . build ( ) ;
271+ assert ! ( !check_ignore( & config, "//@ max-llvm-major-version: 19" ) ) ;
272+
273+ let config: Config = cfg ( ) . llvm_version ( "19.1.2" ) . build ( ) ;
274+ assert ! ( !check_ignore( & config, "//@ max-llvm-major-version: 19" ) ) ;
275+
276+ let config: Config = cfg ( ) . llvm_version ( "20.0.0" ) . build ( ) ;
277+ assert ! ( check_ignore( & config, "//@ max-llvm-major-version: 19" ) ) ;
269278}
270279
271280#[ test]
You can’t perform that action at this time.
0 commit comments