Skip to content

Commit 4d2ba9d

Browse files
committed
ir: We really need to traverse all edges for the used template parameter analysis to be sound.
1 parent b51ddf3 commit 4d2ba9d

File tree

2 files changed

+1
-29
lines changed

2 files changed

+1
-29
lines changed

src/ir/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ impl<'ctx, 'gen> WhitelistedItems<'ctx, 'gen>
219219
where R: IntoIterator<Item = ItemId>,
220220
{
221221
let predicate = if ctx.options().whitelist_recursively {
222-
traversal::codegen_edges
222+
traversal::all_edges
223223
} else {
224224
traversal::no_edges
225225
};

src/ir/traversal.rs

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -201,34 +201,6 @@ pub fn all_edges(_: &BindgenContext, _: Edge) -> bool {
201201
true
202202
}
203203

204-
/// A `TraversalPredicate` implementation that only follows edges to items that
205-
/// are enabled for code generation. This lets us skip considering items for
206-
/// which we won't generate any bindings to.
207-
pub fn codegen_edges(ctx: &BindgenContext, edge: Edge) -> bool {
208-
let cc = &ctx.options().codegen_config;
209-
match edge.kind {
210-
EdgeKind::Generic => ctx.resolve_item(edge.to).is_enabled_for_codegen(ctx),
211-
212-
// We statically know the kind of item that non-generic edges can point
213-
// to, so we don't need to actually resolve the item and check
214-
// `Item::is_enabled_for_codegen`.
215-
EdgeKind::TemplateParameterDefinition |
216-
EdgeKind::TemplateArgument |
217-
EdgeKind::TemplateDeclaration |
218-
EdgeKind::BaseMember |
219-
EdgeKind::Field |
220-
EdgeKind::InnerType |
221-
EdgeKind::FunctionReturn |
222-
EdgeKind::FunctionParameter |
223-
EdgeKind::VarType |
224-
EdgeKind::TypeReference => cc.types,
225-
EdgeKind::InnerVar => cc.vars,
226-
EdgeKind::Method => cc.methods,
227-
EdgeKind::Constructor => cc.constructors,
228-
EdgeKind::Destructor => cc.destructors,
229-
}
230-
}
231-
232204
/// A `TraversalPredicate` implementation that never follows any edges, and
233205
/// therefore traversals using this predicate will only visit the traversal's
234206
/// roots.

0 commit comments

Comments
 (0)