Skip to content

Commit 3f72b80

Browse files
committed
options: Add a --clang-version flag that prints the clang version and exits.
Fixes #2138
1 parent bcbd72d commit 3f72b80

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/options.rs

+9-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ where
2828
.usage("bindgen [FLAGS] [OPTIONS] <header> -- <clang-args>...")
2929
.args(&[
3030
Arg::with_name("header")
31-
.help("C or C++ header file")
32-
.required(true),
31+
.help("C or C++ header file"),
3332
Arg::with_name("depfile")
3433
.long("depfile")
3534
.takes_value(true)
@@ -534,11 +533,19 @@ where
534533
Arg::with_name("explicit-padding")
535534
.long("explicit-padding")
536535
.help("Always output explicit padding fields."),
536+
Arg::with_name("clang-version")
537+
.long("clang-version")
538+
.help("Prints the clang version, and exits"),
537539
]) // .args()
538540
.get_matches_from(args);
539541

540542
let mut builder = builder();
541543

544+
if matches.is_present("clang-version") {
545+
println!("{}", crate::clang_version().full);
546+
std::process::exit(0);
547+
}
548+
542549
if let Some(header) = matches.value_of("header") {
543550
builder = builder.header(header);
544551
} else {

0 commit comments

Comments
 (0)