Commit 430055d
committed
Add ParseCallbacks::allow_item() and ParseCallbacks::block_item().
Like `allowlist_item` and `blocklist_item` options, add new methods to
`ParseCallbacks`, `ParseCallbacks::allow_item()` and
`ParseCallbacks::block_item()`, to be able to allow and block items from
being generated.
`allowlist_*` and `blocklist_*` options work with regexes and are
inserted in a RegexSet.
There are two issues with this approach:
1. In some cases we want to have more flexibility than just using
regexes. If we want to have dynamic conditions to allow or block
items, using regexes can be limited.
2. RegexSet scales linearly with the number of elements inserted. This
means that if we have a huge number of items that we want to allow or
block, regexes and RegexSet are not necessarily the most appropriate
data structures.
Using new methods in `ParseCallbacks` solves these two issues.
We can manually decide the appropriate rules and data structure to match
the items.
`ParseCallbacks::allow_item()` and `ParseCallbacks::block_item()` are
always called after the `allowlist_*` and `blocklist_*` options, and
allow or do not block the items by default respectively.1 parent 1f02556 commit 430055d
File tree
10 files changed
+262
-12
lines changed- bindgen-tests/tests
- expectations/tests
- headers
- parse_callbacks
- bindgen
- codegen
- ir
10 files changed
+262
-12
lines changedLines changed: 48 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 52 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
162 | 180 | | |
163 | 181 | | |
164 | 182 | | |
| |||
168 | 186 | | |
169 | 187 | | |
170 | 188 | | |
| 189 | + | |
| 190 | + | |
171 | 191 | | |
172 | 192 | | |
173 | 193 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
174 | 192 | | |
175 | 193 | | |
176 | 194 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
4942 | 4942 | | |
4943 | 4943 | | |
4944 | 4944 | | |
4945 | | - | |
| 4945 | + | |
| 4946 | + | |
| 4947 | + | |
| 4948 | + | |
| 4949 | + | |
| 4950 | + | |
| 4951 | + | |
| 4952 | + | |
4946 | 4953 | | |
4947 | 4954 | | |
4948 | 4955 | | |
| |||
5259 | 5266 | | |
5260 | 5267 | | |
5261 | 5268 | | |
| 5269 | + | |
5262 | 5270 | | |
5263 | 5271 | | |
5264 | 5272 | | |
| |||
5389 | 5397 | | |
5390 | 5398 | | |
5391 | 5399 | | |
| 5400 | + | |
| 5401 | + | |
| 5402 | + | |
| 5403 | + | |
5392 | 5404 | | |
5393 | | - | |
| 5405 | + | |
| 5406 | + | |
| 5407 | + | |
5394 | 5408 | | |
5395 | 5409 | | |
5396 | 5410 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
2519 | 2520 | | |
2520 | 2521 | | |
2521 | 2522 | | |
| 2523 | + | |
| 2524 | + | |
| 2525 | + | |
| 2526 | + | |
| 2527 | + | |
| 2528 | + | |
| 2529 | + | |
| 2530 | + | |
2522 | 2531 | | |
2523 | 2532 | | |
2524 | 2533 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
653 | 653 | | |
654 | 654 | | |
655 | 655 | | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
656 | 660 | | |
657 | 661 | | |
658 | 662 | | |
| |||
667 | 671 | | |
668 | 672 | | |
669 | 673 | | |
670 | | - | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
671 | 677 | | |
672 | 678 | | |
673 | 679 | | |
| |||
818 | 824 | | |
819 | 825 | | |
820 | 826 | | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
821 | 837 | | |
822 | 838 | | |
823 | 839 | | |
| |||
925 | 941 | | |
926 | 942 | | |
927 | 943 | | |
928 | | - | |
929 | | - | |
930 | | - | |
931 | | - | |
932 | | - | |
933 | | - | |
934 | | - | |
935 | | - | |
| 944 | + | |
936 | 945 | | |
937 | 946 | | |
938 | 947 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
591 | 591 | | |
592 | 592 | | |
593 | 593 | | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
594 | 608 | | |
595 | 609 | | |
596 | 610 | | |
| |||
0 commit comments