Skip to content

Commit 19a1b11

Browse files
kkysenfw-immunant
authored andcommitted
(c2rust-transpile.rs) Inlined and reorganized the args to c2rust_transpile::transpile.
1 parent 35431bd commit 19a1b11

File tree

1 file changed

+16
-19
lines changed

1 file changed

+16
-19
lines changed

c2rust/src/bin/c2rust-transpile.rs

+16-19
Original file line numberDiff line numberDiff line change
@@ -168,23 +168,6 @@ fn main() {
168168
let args = Args::parse();
169169

170170
// Build a TranspilerConfig from the command line
171-
let cc_json_path = Path::new(&args.compile_commands);
172-
let cc_json_path = cc_json_path.canonicalize().unwrap_or_else(|_| {
173-
panic!(
174-
"Could not find compile_commands.json file at path: {}",
175-
cc_json_path.display()
176-
)
177-
});
178-
179-
let extra_args = args
180-
.extra_clang_args
181-
.iter()
182-
.map(AsRef::as_ref)
183-
.collect::<Vec<_>>();
184-
let extra_args = extra_args.as_slice();
185-
186-
let enabled_warnings = args.warn.into_iter().collect();
187-
188171
let mut tcfg = TranspilerConfig {
189172
dump_untyped_context: args.dump_untyped_clang_ast,
190173
dump_typed_context: args.dump_typed_clang_ast,
@@ -231,7 +214,7 @@ fn main() {
231214
panic_on_translator_failure: args.invalid_code == InvalidCodes::Panic,
232215
replace_unsupported_decls: ReplaceMode::Extern,
233216
emit_no_std: args.emit_no_std,
234-
enabled_warnings,
217+
enabled_warnings: args.warn.into_iter().collect(),
235218
log_level: args.log_level,
236219
};
237220
// binaries imply emit-build-files
@@ -243,5 +226,19 @@ fn main() {
243226
tcfg.emit_modules = true
244227
};
245228

246-
c2rust_transpile::transpile(tcfg, &cc_json_path, extra_args);
229+
let cc_json_path = Path::new(&args.compile_commands);
230+
let cc_json_path = cc_json_path.canonicalize().unwrap_or_else(|_| {
231+
panic!(
232+
"Could not find compile_commands.json file at path: {}",
233+
cc_json_path.display()
234+
)
235+
});
236+
237+
let extra_args = args
238+
.extra_clang_args
239+
.iter()
240+
.map(AsRef::as_ref)
241+
.collect::<Vec<_>>();
242+
243+
c2rust_transpile::transpile(tcfg, &cc_json_path, &extra_args);
247244
}

0 commit comments

Comments
 (0)