diff --git a/src/compiler/clang.rs b/src/compiler/clang.rs index d5cd322597..e909d9ebca 100644 --- a/src/compiler/clang.rs +++ b/src/compiler/clang.rs @@ -159,6 +159,7 @@ impl CCompilerImpl for Clang { } counted_array!(pub static ARGS: [ArgInfo; _] = [ + take_arg!("--dependent-lib", OsString, Concatenated('='), PassThrough), take_arg!("--serialize-diagnostics", OsString, Separated, PassThrough), take_arg!("--target", OsString, Separated, PassThrough), // Note: for clang we must override the dep options from gcc.rs with `CanBeSeparated`. @@ -184,6 +185,7 @@ counted_array!(pub static ARGS: [ArgInfo; _] = [ take_arg!("-fprofile-use", PathBuf, Concatenated('='), ClangProfileUse), take_arg!("-fsanitize-blacklist", PathBuf, Concatenated('='), ExtraHashFile), take_arg!("-gcc-toolchain", OsString, Separated, PassThrough), + flag!("-gcodeview", PreprocessorArgumentFlag), take_arg!("-include-pch", PathBuf, CanBeSeparated, PreprocessorArgumentPath), take_arg!("-load", PathBuf, Separated, ExtraHashFile), take_arg!("-mllvm", OsString, Separated, PassThrough), @@ -297,6 +299,25 @@ mod test { assert_eq!(ovec!["-arch", "xyz"], a.arch_args); } + #[test] + fn test_dependent_lib() { + let a = parses!("-c", "foo.c", "-o", "foo.o", "-Xclang", "--dependent-lib=msvcrt"); + assert_eq!(Some("foo.c"), a.input.to_str()); + assert_eq!(Language::C, a.language); + assert_map_contains!( + a.outputs, + ( + "obj", + ArtifactDescriptor { + path: PathBuf::from("foo.o"), + optional: false + } + ) + ); + assert_eq!(ovec!["-Xclang", "--dependent-lib=msvcrt"], a.common_args); + // assert!(a.common_args.is_empty()); + } + #[test] fn test_parse_arguments_others() { parses!("-c", "foo.c", "-B", "somewhere", "-o", "foo.o"); @@ -352,7 +373,7 @@ mod test { ]) ); assert_eq!( - CompilerArguments::CannotCache("Can't handle UnknownFlag arguments with -Xclang", None), + CompilerArguments::CannotCache("Can't handle UnknownFlag arguments with -Xclang", Some("-broken".to_string())), parse_arguments_(stringvec![ "-c", "foo.c", "-o", "foo.o", "-Xclang", "-broken" ]) diff --git a/src/compiler/gcc.rs b/src/compiler/gcc.rs index 23aef9ed1d..71aa5606fc 100644 --- a/src/compiler/gcc.rs +++ b/src/compiler/gcc.rs @@ -436,8 +436,8 @@ where None => match arg { Argument::Raw(_) if follows_plugin_arg => &mut common_args, Argument::Raw(_) => cannot_cache!("Can't handle Raw arguments with -Xclang"), - Argument::UnknownFlag(_) => { - cannot_cache!("Can't handle UnknownFlag arguments with -Xclang") + Argument::UnknownFlag(flag) => { + cannot_cache!("Can't handle UnknownFlag arguments with -Xclang", flag.to_str().unwrap_or("").to_string()) } _ => unreachable!(), },