-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into upgrade-llvm
- Loading branch information
Showing
12 changed files
with
303 additions
and
278 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,16 @@ | ||
use os_info::{Type, Version}; | ||
|
||
/// Returns default `TargetTriple` | ||
#[cfg(feature = "mac")] | ||
pub fn default_triple() -> inkwell::targets::TargetTriple { | ||
if let Ok(info) = mac_sys_info::get_mac_sys_info() { | ||
// #281: get_default_triple returns `darwin` but clang shows warning for it | ||
let arch = info.cpu_info().architecture(); | ||
let ver = info.os_info().os_version(); | ||
// #281: Add .0 | ||
let n_dots = ver.chars().filter(|c| *c == '.').count(); | ||
let zero = if n_dots >= 2 { "" } else { ".0" }; | ||
let s = format!("{}-apple-macosx{}{}", arch, ver, zero); | ||
inkwell::targets::TargetTriple::create(&s) | ||
} else { | ||
inkwell::targets::TargetMachine::get_default_triple() | ||
let info = os_info::get(); | ||
if info.os_type() == Type::Macos { | ||
// #281: calculate target triple to avoid clang's warning | ||
if let Some(arch) = info.architecture() { | ||
if let Version::Semantic(major, minor, patch) = info.version() { | ||
let s = format!("{}-apple-macosx{}.{}.{}", arch, major, minor, patch); | ||
return inkwell::targets::TargetTriple::create(&s); | ||
} | ||
} | ||
} | ||
} | ||
|
||
#[cfg(not(feature = "mac"))] | ||
pub fn default_triple() -> inkwell::targets::TargetTriple { | ||
inkwell::targets::TargetMachine::get_default_triple() | ||
} |