summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ir/function.rs3
-rw-r--r--src/lib.rs14
-rw-r--r--src/options.rs7
3 files changed, 23 insertions, 1 deletions
diff --git a/src/ir/function.rs b/src/ir/function.rs
index 941694ff..fd88b657 100644
--- a/src/ir/function.rs
+++ b/src/ir/function.rs
@@ -310,7 +310,8 @@ impl ClangSubItemParser for Function {
return Err(ParseError::Continue);
}
- if cursor.is_inlined_function() {
+ if !context.options().generate_inline_functions &&
+ cursor.is_inlined_function() {
return Err(ParseError::Continue);
}
diff --git a/src/lib.rs b/src/lib.rs
index e92be92b..433198b0 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -415,6 +415,16 @@ impl Builder {
self
}
+ /// Whether inline functions should be generated or not.
+ ///
+ /// Note that they will usually not work. However you can use
+ /// `-fkeep-inline-functions` or `-fno-inline-functions` if you are
+ /// responsible of compiling the library to make them callable.
+ pub fn generate_inline_functions(mut self, doit: bool) -> Self {
+ self.options.generate_inline_functions = doit;
+ self
+ }
+
/// Ignore functions.
pub fn ignore_functions(mut self) -> Builder {
self.options.codegen_config.functions = false;
@@ -584,6 +594,9 @@ pub struct BindgenOptions {
/// documentation for more details.
pub generate_comments: bool,
+ /// Whether to generate inline functions. Defaults to false.
+ pub generate_inline_functions: bool,
+
/// Wether to whitelist types recursively. Defaults to true.
pub whitelist_recursively: bool,
@@ -654,6 +667,7 @@ impl Default for BindgenOptions {
codegen_config: CodegenConfig::all(),
conservative_inline_namespaces: false,
generate_comments: true,
+ generate_inline_functions: false,
whitelist_recursively: true,
objc_extern_crate: false,
enable_mangling: true,
diff --git a/src/options.rs b/src/options.rs
index 15146b39..f1c8479a 100644
--- a/src/options.rs
+++ b/src/options.rs
@@ -177,6 +177,9 @@ pub fn builder_from_flags<I>
.takes_value(true)
.multiple(true)
.number_of_values(1),
+ Arg::with_name("generate-inline-functions")
+ .long("generate-inline-functions")
+ .help("Whether inline functions should be generated."),
Arg::with_name("whitelist-type")
.long("whitelist-type")
.help("Whitelist the type. Other non-whitelisted types will \
@@ -357,6 +360,10 @@ pub fn builder_from_flags<I>
builder = builder.conservative_inline_namespaces();
}
+ if matches.is_present("generate-inline-functions") {
+ builder = builder.generate_inline_functions(true);
+ }
+
if let Some(whitelist) = matches.values_of("whitelist-function") {
for regex in whitelist {
builder = builder.whitelisted_function(regex);