Skip to content

Commit 132a6fa

Browse files
committed
Add ignore_methods to bindgen
1 parent 5d7c4d7 commit 132a6fa

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

src/bin/bindgen.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@ fn parse_args(args: &[String]) -> ParseResult {
117117
options.ignore_functions = true;
118118
ix += 1;
119119
}
120+
"-ignore-methods" => {
121+
options.ignore_methods = true;
122+
ix += 1;
123+
}
120124
"-no-bitfield-methods" => {
121125
options.gen_bitfield_methods = false;
122126
ix += 1;

src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ pub struct BindgenOptions {
159159
pub links: Vec<(String, LinkType)>,
160160
pub emit_ast: bool,
161161
pub ignore_functions: bool,
162+
pub ignore_methods: bool,
162163
pub gen_bitfield_methods: bool,
163164
pub fail_on_unknown_type: bool,
164165
pub enable_cxx_namespaces: bool,
@@ -190,6 +191,7 @@ impl Default for BindgenOptions {
190191
links: vec![],
191192
emit_ast: false,
192193
ignore_functions: false,
194+
ignore_methods: false,
193195
gen_bitfield_methods: true,
194196
fail_on_unknown_type: true,
195197
rename_types: true,
@@ -322,6 +324,7 @@ fn parse_headers(options: &BindgenOptions, logger: &Logger) -> Result<ModuleMap,
322324
class_constants: options.class_constants,
323325
namespaced_constants: options.namespaced_constants,
324326
ignore_functions: options.ignore_functions,
327+
ignore_methods: options.ignore_methods,
325328
fail_on_unknown_type: options.fail_on_unknown_type,
326329
enable_cxx_namespaces: options.enable_cxx_namespaces,
327330
override_enum_ty: str_to_ikind(&options.override_enum_ty),

src/parser.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ pub struct ClangParserOptions {
2424
pub emit_ast: bool,
2525
pub fail_on_unknown_type: bool,
2626
pub ignore_functions: bool,
27+
pub ignore_methods: bool,
2728
pub enable_cxx_namespaces: bool,
2829
pub class_constants: bool,
2930
pub namespaced_constants: bool,
@@ -1023,7 +1024,7 @@ fn visit_composite(cursor: &Cursor, parent: &Cursor,
10231024
vi.is_static = cursor.method_is_static();
10241025
vi.is_const = cursor.cur_type().is_const();
10251026

1026-
if ctx.options.ignore_functions {
1027+
if ctx.options.ignore_methods {
10271028
return CXChildVisit_Continue;
10281029
}
10291030

0 commit comments

Comments
 (0)