@@ -123,6 +123,8 @@ ArgData! { pub
123123 PassThroughFlag ,
124124 PassThrough ( OsString ) ,
125125 PassThroughPath ( PathBuf ) ,
126+ TopsDeviceLibPath ( PathBuf ) ,
127+ TopsDeviceLib ( OsString ) ,
126128 PreprocessorArgumentFlag ,
127129 PreprocessorArgument ( OsString ) ,
128130 PreprocessorArgumentPath ( PathBuf ) ,
@@ -162,6 +164,8 @@ counted_array!(pub static ARGS: [ArgInfo<ArgData>; _] = [
162164 flag!( "--save-temps" , TooHardFlag ) ,
163165 take_arg!( "--serialize-diagnostics" , PathBuf , Separated , PassThroughPath ) ,
164166 take_arg!( "--sysroot" , PathBuf , Separated , PassThroughPath ) ,
167+ take_arg!( "--tops-device-lib" , OsString , Concatenated ( '=' ) , TopsDeviceLib ) ,
168+ take_arg!( "--tops-device-lib-path" , PathBuf , Concatenated ( '=' ) , TopsDeviceLibPath ) ,
165169 take_arg!( "-A" , OsString , Separated , PassThrough ) ,
166170 take_arg!( "-B" , PathBuf , CanBeSeparated , PassThroughPath ) ,
167171 take_arg!( "-D" , OsString , CanBeSeparated , PassThrough ) ,
@@ -284,6 +288,7 @@ where
284288 let mut color_mode = ColorMode :: Auto ;
285289 let mut seen_arch = None ;
286290 let dont_cache_multiarch = env:: var ( "SCCACHE_CACHE_MULTIARCH" ) . is_err ( ) ;
291+ let mut tops_device_lib_path = PathBuf :: new ( ) ;
287292
288293 // Custom iterator to expand `@` arguments which stand for reading a file
289294 // and interpreting it as a list of more arguments.
@@ -330,6 +335,13 @@ where
330335 compilation_flag =
331336 OsString :: from ( arg. flag_str ( ) . expect ( "Compilation flag expected" ) ) ;
332337 }
338+ Some ( TopsDeviceLibPath ( _tops_device_lib_path) ) => tops_device_lib_path = _tops_device_lib_path. to_path_buf ( ) ,
339+ Some ( TopsDeviceLib ( tops_device_lib_) ) => {
340+ if ! tops_device_lib_path. as_os_str ( ) . is_empty ( ) {
341+ let tops_device_lib = tops_device_lib_path. join ( tops_device_lib_) ;
342+ extra_hash_files. push ( tops_device_lib. clone ( ) ) ;
343+ }
344+ }
333345 Some ( ProfileGenerate ) => profile_generate = true ,
334346 Some ( ClangProfileUse ( path) ) => {
335347 extra_hash_files. push ( clang:: resolve_profile_use_path ( path, cwd) ) ;
@@ -379,6 +391,7 @@ where
379391 "objective-c" => Some ( Language :: ObjectiveC ) ,
380392 "objective-c++" => Some ( Language :: ObjectiveCxx ) ,
381393 "cu" => Some ( Language :: Cuda ) ,
394+ "tops" => Some ( Language :: Tops ) ,
382395 "rs" => Some ( Language :: Rust ) ,
383396 "cuda" => Some ( Language :: Cuda ) ,
384397 "hip" => Some ( Language :: Hip ) ,
@@ -427,6 +440,8 @@ where
427440 | Some ( NoDiagnosticsColorFlag )
428441 | Some ( PassThroughFlag )
429442 | Some ( PassThrough ( _) )
443+ | Some ( TopsDeviceLibPath ( _) )
444+ | Some ( TopsDeviceLib ( _) )
430445 | Some ( PassThroughPath ( _) ) => & mut common_args,
431446 Some ( Unhashed ( _) ) => & mut unhashed_args,
432447 Some ( Arch ( _) ) => & mut arch_args,
@@ -504,6 +519,8 @@ where
504519 | Some ( NoDiagnosticsColorFlag )
505520 | Some ( Arch ( _) )
506521 | Some ( PassThrough ( _) )
522+ | Some ( TopsDeviceLibPath ( _) )
523+ | Some ( TopsDeviceLib ( _) )
507524 | Some ( PassThroughFlag )
508525 | Some ( PassThroughPath ( _) ) => & mut common_args,
509526 Some ( Unhashed ( _) ) => & mut unhashed_args,
@@ -645,6 +662,7 @@ fn language_to_gcc_arg(lang: Language) -> Option<&'static str> {
645662 Language :: ObjectiveC => Some ( "objective-c" ) ,
646663 Language :: ObjectiveCxx => Some ( "objective-c++" ) ,
647664 Language :: Cuda => Some ( "cu" ) ,
665+ Language :: Tops => Some ( "tops" ) ,
648666 Language :: Rust => None , // Let the compiler decide
649667 Language :: Hip => Some ( "hip" ) ,
650668 Language :: GenericHeader => None , // Let the compiler decide
@@ -668,7 +686,7 @@ fn preprocess_cmd<T>(
668686 if let Some ( lang) = & language {
669687 cmd. arg ( "-x" ) . arg ( lang) ;
670688 }
671- cmd. arg ( "-E" ) ;
689+ cmd. arg ( "-E" ) . arg ( "-o" ) . arg ( "-" ) ;
672690 // When performing distributed compilation, line number info is important for error
673691 // reporting and to not cause spurious compilation failure (e.g. no exceptions build
674692 // fails due to exceptions transitively included in the stdlib).
0 commit comments