Skip to content

Commit 6da5754

Browse files
author
bors-servo
authored
Auto merge of #30 - Manishearth:ignore_methods, r=emilio
Add ignore_methods to bindgen I'm defining a struct inline in ServoBindings.h via a macro (for the already_addrefed stuff), and I need to forbid its ignore_methods from getting generated without forbidding functions as well. r? @bholley
2 parents 5d7c4d7 + 132a6fa commit 6da5754

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

src/bin/bindgen.rs

+4
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

+3
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

+2-1
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)