mirror of https://github.com/rust-lang/rust.git
Address CDB review feedback
- Don't add path_buf_capacity feature. - Convert `find_cdb` to early return style, reducing indentation - Simplify `compute_stamp_hash` for CDB to just hash it's path, if any.
This commit is contained in:
parent
0a423a70bb
commit
56b18ce637
|
@ -1,6 +1,5 @@
|
|||
#![crate_name = "compiletest"]
|
||||
#![feature(test)]
|
||||
#![feature(path_buf_capacity)]
|
||||
#![feature(vec_remove_item)]
|
||||
#![deny(warnings, rust_2018_idioms)]
|
||||
|
||||
|
@ -857,35 +856,34 @@ fn is_pc_windows_msvc_target(target: &String) -> bool {
|
|||
}
|
||||
|
||||
fn find_cdb(target: &String) -> Option<OsString> {
|
||||
if cfg!(windows) && is_pc_windows_msvc_target(target) {
|
||||
let pf86 = env::var_os("ProgramFiles(x86)").or(env::var_os("ProgramFiles"))?;
|
||||
let cdb_arch = if cfg!(target_arch="x86") {
|
||||
"x86"
|
||||
} else if cfg!(target_arch="x86_64") {
|
||||
"x64"
|
||||
} else if cfg!(target_arch="aarch64") {
|
||||
"arm64"
|
||||
} else if cfg!(target_arch="arm") {
|
||||
"arm"
|
||||
} else {
|
||||
return None; // No compatible CDB.exe in the Windows 10 SDK
|
||||
};
|
||||
|
||||
let mut path = PathBuf::with_capacity(64);
|
||||
path.push(pf86);
|
||||
path.push(r"Windows Kits\10\Debuggers"); // We could check 8.1 etc. too?
|
||||
path.push(cdb_arch);
|
||||
path.push(r"cdb.exe");
|
||||
|
||||
if path.exists() {
|
||||
Some(path.into_os_string())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
if !(cfg!(windows) && is_pc_windows_msvc_target(target)) {
|
||||
return None;
|
||||
}
|
||||
else {
|
||||
None
|
||||
|
||||
let pf86 = env::var_os("ProgramFiles(x86)").or(env::var_os("ProgramFiles"))?;
|
||||
let cdb_arch = if cfg!(target_arch="x86") {
|
||||
"x86"
|
||||
} else if cfg!(target_arch="x86_64") {
|
||||
"x64"
|
||||
} else if cfg!(target_arch="aarch64") {
|
||||
"arm64"
|
||||
} else if cfg!(target_arch="arm") {
|
||||
"arm"
|
||||
} else {
|
||||
return None; // No compatible CDB.exe in the Windows 10 SDK
|
||||
};
|
||||
|
||||
let mut path = PathBuf::new();
|
||||
path.push(pf86);
|
||||
path.push(r"Windows Kits\10\Debuggers"); // We could check 8.1 etc. too?
|
||||
path.push(cdb_arch);
|
||||
path.push(r"cdb.exe");
|
||||
|
||||
if !path.exists() {
|
||||
return None;
|
||||
}
|
||||
|
||||
Some(path.into_os_string())
|
||||
}
|
||||
|
||||
/// Returns Path to CDB
|
||||
|
|
|
@ -244,11 +244,7 @@ pub fn compute_stamp_hash(config: &Config) -> String {
|
|||
config.stage_id.hash(&mut hash);
|
||||
|
||||
if config.mode == DebugInfoCdb {
|
||||
match config.cdb {
|
||||
None => env::var_os("ProgramFiles(x86)").hash(&mut hash),
|
||||
Some(ref s) if s.is_empty() => env::var_os("ProgramFiles(x86)").hash(&mut hash),
|
||||
Some(ref s) => s.hash(&mut hash),
|
||||
}
|
||||
config.cdb.hash(&mut hash);
|
||||
}
|
||||
|
||||
if config.mode == DebugInfoGdb || config.mode == DebugInfoGdbLldb {
|
||||
|
|
Loading…
Reference in New Issue