Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document and test allowlisting and blocklisting methods #2344

Merged
merged 1 commit into from Nov 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
35 changes: 35 additions & 0 deletions bindgen-tests/tests/expectations/tests/blocklist-methods.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions bindgen-tests/tests/headers/blocklist-methods.hpp
@@ -0,0 +1,8 @@
// bindgen-flags: --blocklist-function="Foo_ba.*"

class Foo {
public:
int foo();
int bar();
int baz();
};
8 changes: 8 additions & 0 deletions bindgen/lib.rs
Expand Up @@ -850,6 +850,10 @@ impl Builder {
/// Hide the given function from the generated bindings. Regular expressions
/// are supported.
///
/// Methods can be blocklisted by prefixing the name of the type implementing
/// them followed by an underscore. So if `Foo` has a method `bar`, it can
/// be blocklisted as `Foo_bar`.
///
/// To blocklist functions prefixed with "mylib" use `"mylib_.*"`.
/// For more complicated expressions check
/// [regex](https://docs.rs/regex/*/regex/) docs
Expand Down Expand Up @@ -929,6 +933,10 @@ impl Builder {
/// transitively refers to) appears in the generated bindings. Regular
/// expressions are supported.
///
/// Methods can be allowlisted by prefixing the name of the type
/// implementing them followed by an underscore. So if `Foo` has a method
/// `bar`, it can be allowlisted as `Foo_bar`.
///
/// To allowlist functions prefixed with "mylib" use `"mylib_.*"`.
/// For more complicated expressions check
/// [regex](https://docs.rs/regex/*/regex/) docs
Expand Down