Skip to content

Commit b3a95bc

Browse files
test: ensure clang --driver-mode=cl is MSVC- and clang-cl-like
1 parent 798e336 commit b3a95bc

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2708,7 +2708,7 @@ impl Build {
27082708
let out_dir = self.get_out_dir().ok();
27092709
let out_dir = out_dir.as_deref();
27102710

2711-
if let Some(c) = &self.compiler {
2711+
if let Some(c) = dbg!(&self.compiler) {
27122712
return Ok(Tool::new(
27132713
(**c).to_owned(),
27142714
&self.build_cache.cached_compiler_family,

tests/cc_env.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,21 @@ fn more_spaces() {
110110
let compiler = test.gcc().file("foo.c").get_compiler();
111111
assert_eq!(compiler.path(), Path::new("cc"));
112112
}
113+
114+
fn clang_cl() {
115+
let test = |cc| {
116+
let test = Test::clang();
117+
env::set_var("CC", cc);
118+
let test_compiler = |build: cc::Build| {
119+
let compiler = build.get_compiler();
120+
assert_eq!(compiler.path(), Path::new("clang"));
121+
// assert_eq!(compiler.args(), vec!["--driver-mode=cl"]);
122+
assert!(compiler.is_like_msvc());
123+
assert!(compiler.is_like_clang_cl());
124+
};
125+
test_compiler(test.gcc());
126+
};
127+
128+
test("clang --driver-mode=cl");
129+
// test("clang.exe --driver-mode=cl");
130+
}

0 commit comments

Comments
 (0)