Skip to content

Commit

Permalink
tool: Add is_like_clang_cl() getter
Browse files Browse the repository at this point in the history
In `ring` we need to check if the compiler is `clang-cl`
to prevent overwriting it with `clang` (see all details in
briansmith/ring#2215), but `cc-rs` does not
currently expose this despite already tracking it.  By adding this
getter we can steer that logic to not overwrite the compiler when it
is `clang-cl`.

Perhaps, since `ToolFamily` is `pub` (but not yet reexported from
`lib.rs`), could we have a public `Tool::family()` getter to not have
to extend these `is_xxx()` getters whenever a downstream crate wants to
know something new?
  • Loading branch information
MarijnS95 committed Jan 10, 2025
1 parent 5e17879 commit 5f58a7c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,11 @@ impl Tool {
matches!(self.family, ToolFamily::Msvc { .. })
}

/// Whether the tool is `clang-cl`-based MSVC-like.
pub fn is_like_clang_cl(&self) -> bool {
matches!(self.family, ToolFamily::Msvc { clang_cl: true })
}

/// Supports using `--` delimiter to separate arguments and path to source files.
pub(crate) fn supports_path_delimiter(&self) -> bool {
matches!(
Expand Down

0 comments on commit 5f58a7c

Please sign in to comment.