summaryrefslogtreecommitdiff
path: root/bindgen-cli/options.rs
diff options
context:
space:
mode:
Diffstat (limited to 'bindgen-cli/options.rs')
-rw-r--r--bindgen-cli/options.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/bindgen-cli/options.rs b/bindgen-cli/options.rs
index 5c3960e9..c186cfd9 100644
--- a/bindgen-cli/options.rs
+++ b/bindgen-cli/options.rs
@@ -568,6 +568,12 @@ where
Arg::new("merge-extern-blocks")
.long("merge-extern-blocks")
.help("Deduplicates extern blocks."),
+ Arg::new("override-abi")
+ .long("override-abi")
+ .help("Overrides the ABI of functions matching <regex>. The <override> value must be of the shape <abi>:<regex> where <abi> can be one of C, stdcall, fastcall, thiscall, aapcs or win64.")
+ .value_name("override")
+ .multiple_occurrences(true)
+ .number_of_values(1),
Arg::new("V")
.long("version")
.help("Prints the version, and exits"),
@@ -1088,5 +1094,17 @@ where
builder = builder.merge_extern_blocks(true);
}
+ if let Some(abi_overrides) = matches.values_of("override-abi") {
+ for abi_override in abi_overrides {
+ let (regex, abi_str) = abi_override
+ .rsplit_once("=")
+ .expect("Invalid ABI override: Missing `=`");
+ let abi = abi_str
+ .parse()
+ .unwrap_or_else(|err| panic!("Invalid ABI override: {}", err));
+ builder = builder.override_abi(abi, regex);
+ }
+ }
+
Ok((builder, output, verbose))
}