We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 56fa410 commit 2b2d229Copy full SHA for 2b2d229
1 file changed
c2rust-transpile/src/c_ast/mod.rs
@@ -1202,6 +1202,20 @@ impl TypedAstContext {
1202
to_walk.push(parent_id);
1203
}
1204
1205
+
1206
+ // `__attribute__((cleanup(func)))` references its cleanup
1207
+ // function through the attribute payload, not via a
1208
+ // DeclRef the traversal would otherwise see, so mark it
1209
+ // here.
1210
+ if let CDeclKind::Variable { ref attrs, .. } = self.c_decls[&decl_id].kind {
1211
+ for attr in attrs {
1212
+ if let Attribute::Cleanup(fn_id) = attr {
1213
+ if wanted.insert(*fn_id) {
1214
+ to_walk.push(*fn_id);
1215
+ }
1216
1217
1218
1219
1220
1221
// Stmts can include decls, but we'll see the DeclId itself in a later
0 commit comments