Skip to content

Commit

Permalink
Support -Xclang -no-opaque-pointers in clang
Browse files Browse the repository at this point in the history
Some projects, such as chromium, have recently been using
`-Xclang -no-opaque-pointers` [1] to deal with the issue of changing
opaque pointers in llvm[2], but the current sccache cannot handle that
flag.

This patch is to teach sccache to parse those flags so that it can solve
issues like [3].

[1] https://chromium-review.googlesource.com/c/chromium/src/+/3584317
[2] https://llvm.org/docs/OpaquePointers.html
[3] denoland/rusty_v8#971
  • Loading branch information
bc-lee committed Jun 6, 2022
1 parent 963f137 commit b6f5f69
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/compiler/clang.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ counted_array!(pub static ARGS: [ArgInfo<gcc::ArgData>; _] = [
take_arg!("-include-pch", PathBuf, CanBeSeparated, PreprocessorArgumentPath),
take_arg!("-load", PathBuf, Separated, ExtraHashFile),
take_arg!("-mllvm", OsString, Separated, PassThrough),
flag!("-no-opaque-pointers", PreprocessorArgumentFlag),
take_arg!("-plugin-arg", OsString, Concatenated('-'), PassThrough),
take_arg!("-target", OsString, Separated, PassThrough),
flag!("-verify", PreprocessorArgumentFlag),
Expand Down Expand Up @@ -445,6 +446,12 @@ mod test {
assert_eq!(ovec!["-Xclang", "-verify"], a.preprocessor_args);
}

#[test]
fn test_parse_xclang_no_opaque_pointers() {
let a = parses!("-c", "foo.c", "-o", "foo.o", "-Xclang", "-no-opaque-pointers");
assert_eq!(ovec!["-Xclang", "-no-opaque-pointers"], a.preprocessor_args);
}

#[test]
fn test_parse_fplugin() {
let a = parses!("-c", "foo.c", "-o", "foo.o", "-fplugin", "plugin.so");
Expand Down

0 comments on commit b6f5f69

Please sign in to comment.