Skip to content

Commit 97d62ac

Browse files
Rollup merge of #130048 - nebulark:runmake_llvm_pdbutil, r=jieyouxu
run-make-support: Add llvm-pdbutil Add llvm-pdbutil to run-make-support, so we can write better unit tests for PDB specific features. r? ````@jieyouxu```` ````@rustbot```` label: +O-windows
2 parents c21d31a + ec11001 commit 97d62ac

File tree

1 file changed

+24
-0
lines changed
  • src/tools/run-make-support/src/external_deps

1 file changed

+24
-0
lines changed

src/tools/run-make-support/src/external_deps/llvm.rs

+24
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,13 @@ pub struct LlvmDwarfdump {
110110
cmd: Command,
111111
}
112112

113+
/// A `llvm-pdbutil` invocation builder.
114+
#[derive(Debug)]
115+
#[must_use]
116+
pub struct LlvmPdbutil {
117+
cmd: Command,
118+
}
119+
113120
crate::macros::impl_common_helpers!(LlvmReadobj);
114121
crate::macros::impl_common_helpers!(LlvmProfdata);
115122
crate::macros::impl_common_helpers!(LlvmFilecheck);
@@ -118,6 +125,7 @@ crate::macros::impl_common_helpers!(LlvmAr);
118125
crate::macros::impl_common_helpers!(LlvmNm);
119126
crate::macros::impl_common_helpers!(LlvmBcanalyzer);
120127
crate::macros::impl_common_helpers!(LlvmDwarfdump);
128+
crate::macros::impl_common_helpers!(LlvmPdbutil);
121129

122130
/// Generate the path to the bin directory of LLVM.
123131
#[must_use]
@@ -360,3 +368,19 @@ impl LlvmDwarfdump {
360368
self
361369
}
362370
}
371+
372+
impl LlvmPdbutil {
373+
/// Construct a new `llvm-pdbutil` invocation. This assumes that `llvm-pdbutil` is available
374+
/// at `$LLVM_BIN_DIR/llvm-pdbutil`.
375+
pub fn new() -> Self {
376+
let llvm_pdbutil = llvm_bin_dir().join("llvm-pdbutil");
377+
let cmd = Command::new(llvm_pdbutil);
378+
Self { cmd }
379+
}
380+
381+
/// Provide an input file.
382+
pub fn input<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
383+
self.cmd.arg(path.as_ref());
384+
self
385+
}
386+
}

0 commit comments

Comments
 (0)