Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion extensions/bindgen/private/bindgen.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -303,13 +303,14 @@ def _rust_bindgen_impl(ctx):
# Ideally we could depend on a more specific toolchain, requesting one which is specifically clang via some constraint.
# Unfortunately, we can't currently rely on this, so instead we filter only to flags we know clang supports.
# We can add extra flags here as needed.
# Flags in this tuple accept a parameter in the same argument (`-Ipath`, `--target=T`) or separately (`-I path`).
# Flags in this tuple accept a parameter in the same argument (`-Ipath`, `--target=T`) or separately (`-I path`, `-target T`).
param_flags_known_to_clang = (
"-I",
"-iquote",
"-isystem",
"--sysroot",
"--gcc-toolchain",
"-target",
"--target",
"-W",
"--system-header-prefix",
Expand Down
13 changes: 12 additions & 1 deletion extensions/bindgen/test/bindgen_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ def _fake_cc_toolchain_config_impl(ctx):
"-fexperimental-optimized-noescape",
"-Xclang",
"-fcolor-diagnostics",
"--target=here",
"-target",
"there",
"-notarget",
"idbeholdi",
]),
],
),
Expand Down Expand Up @@ -222,8 +227,14 @@ def _test_strip_xclang_impl(env, target):
env.expect.that_action(target.actions[0]).not_contains_arg(
"-fexperimental-optimized-noescape",
)
env.expect.that_action(target.actions[0]).not_contains_arg(
"-notarget",
)
env.expect.that_action(target.actions[0]).not_contains_arg(
"idbeholdi",
)
env.expect.that_action(target.actions[0]).contains_at_least_args(
["-Xclang", "-fcolor-diagnostics"],
["-Xclang", "-fcolor-diagnostics", "--target=here", "-target", "there"],
)

def _test_strip_xclang(name):
Expand Down