diff options
author | David Drysdale <drysdale@google.com> | 2021-11-29 13:03:26 +0000 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2022-02-18 19:34:58 +0100 |
commit | e180d145a49b09c6d521cdc7989d1a1d4f173541 (patch) | |
tree | d871f3c94e3525dc198fbc1e21c76fd2e0dec247 /tests/headers | |
parent | ddfa28f91f6db2580c2a09c90b06c02455a84229 (diff) |
Add --allowlist-file option
Diffstat (limited to 'tests/headers')
-rw-r--r-- | tests/headers/allowlist-file.hpp | 21 | ||||
-rw-r--r-- | tests/headers/allowlisted/file.hpp | 22 |
2 files changed, 43 insertions, 0 deletions
diff --git a/tests/headers/allowlist-file.hpp b/tests/headers/allowlist-file.hpp new file mode 100644 index 00000000..b0354a04 --- /dev/null +++ b/tests/headers/allowlist-file.hpp @@ -0,0 +1,21 @@ +// bindgen-flags: --allowlist-file ".*/allowlisted/file.*" --allowlist-type AllowlistMe -- -Itests/headers + + +// Forward declaration of struct that's defined in an allowlisted file. +struct StructWithAllowlistedDefinition; + +#include "allowlisted/file.hpp" + +// Actual definition of struct that has a forward declaration in an allowlisted file. +struct StructWithAllowlistedFwdDecl { + int b; +}; + +class Ignored { + char c; +}; + +// Also have an explicitly allowlisted type +class AllowlistMe { + int foo; +}; diff --git a/tests/headers/allowlisted/file.hpp b/tests/headers/allowlisted/file.hpp new file mode 100644 index 00000000..5f360e5e --- /dev/null +++ b/tests/headers/allowlisted/file.hpp @@ -0,0 +1,22 @@ +void SomeFunction(); +extern int someVar; +#define SOME_DEFUN 123 + +class someClass { + void somePrivateMethod(); +public: + void somePublicMethod(int foo); +}; + +extern "C" void ExternFunction(); + +namespace foo { + void NamespacedFunction(); +} + + +struct StructWithAllowlistedFwdDecl; + +struct StructWithAllowlistedDefinition { + StructWithAllowlistedFwdDecl* other; +}; |