1
- use std:: path:: { Path , PathBuf } ;
2
- use std:: process:: { Command , Output } ;
3
- use std:: io:: { BufReader , Read , Write } ;
4
1
use std:: fs:: File ;
2
+ use std:: io:: { BufReader , Read , Write } ;
3
+ use std:: path:: { Path , PathBuf } ;
5
4
6
- use crate :: { env_var, handle_failed_output } ;
5
+ use crate :: { env_var, Command } ;
7
6
8
7
/// Construct a new `llvm-readobj` invocation. This assumes that `llvm-readobj` is available
9
8
/// at `$LLVM_BIN_DIR/llvm-readobj`.
@@ -42,11 +41,12 @@ pub struct LlvmFilecheck {
42
41
}
43
42
44
43
crate :: impl_common_helpers!( LlvmReadobj ) ;
44
+ crate :: impl_common_helpers!( LlvmProfdata ) ;
45
+ crate :: impl_common_helpers!( LlvmFilecheck ) ;
45
46
46
47
/// Generate the path to the bin directory of LLVM.
47
48
pub fn llvm_bin_dir ( ) -> PathBuf {
48
- let llvm_bin_dir = env_var ( "LLVM_BIN_DIR" )
49
- . expect ( "`LLVM_BIN_DIR` not specified, but this is required to find `llvm-readobj`" ) ;
49
+ let llvm_bin_dir = env_var ( "LLVM_BIN_DIR" ) ;
50
50
PathBuf :: from ( llvm_bin_dir)
51
51
}
52
52
@@ -70,12 +70,6 @@ impl LlvmReadobj {
70
70
self . cmd . arg ( "--file-header" ) ;
71
71
self
72
72
}
73
-
74
- /// Get the [`Output`][::std::process::Output] of the finished process.
75
- #[ track_caller]
76
- pub fn command_output ( & mut self ) -> Output {
77
- self . cmd . output ( ) . expect ( "failed to get output of finished process" )
78
- }
79
73
}
80
74
81
75
impl LlvmProfdata {
@@ -89,13 +83,13 @@ impl LlvmProfdata {
89
83
90
84
/// Provide an input file.
91
85
pub fn input < P : AsRef < Path > > ( & mut self , path : P ) -> & mut Self {
92
- self . cmd . arg ( "-o" ) ;
93
86
self . cmd . arg ( path. as_ref ( ) ) ;
94
87
self
95
88
}
96
89
97
90
/// Specify the output file path.
98
91
pub fn output < P : AsRef < Path > > ( & mut self , path : P ) -> & mut Self {
92
+ self . cmd . arg ( "-o" ) ;
99
93
self . cmd . arg ( path. as_ref ( ) ) ;
100
94
self
101
95
}
@@ -106,12 +100,6 @@ impl LlvmProfdata {
106
100
self . cmd . arg ( "merge" ) ;
107
101
self
108
102
}
109
-
110
- /// Get the [`Output`][::std::process::Output] of the finished process.
111
- #[ track_caller]
112
- pub fn command_output ( & mut self ) -> Output {
113
- self . cmd . output ( ) . expect ( "failed to get output of finished process" )
114
- }
115
103
}
116
104
117
105
impl LlvmFilecheck {
0 commit comments