We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3593ecd commit 9d2c082Copy full SHA for 9d2c082
1 file changed
c2rust-transpile/src/c_ast/mod.rs
@@ -1191,6 +1191,20 @@ impl TypedAstContext {
1191
to_walk.push(parent_id);
1192
}
1193
1194
+
1195
+ // `__attribute__((cleanup(func)))` references its cleanup
1196
+ // function through the attribute payload, not via a
1197
+ // DeclRef the traversal would otherwise see, so mark it
1198
+ // here.
1199
+ if let CDeclKind::Variable { ref attrs, .. } = self.c_decls[&decl_id].kind {
1200
+ for attr in attrs {
1201
+ if let Attribute::Cleanup(fn_id) = attr {
1202
+ if wanted.insert(*fn_id) {
1203
+ to_walk.push(*fn_id);
1204
+ }
1205
1206
1207
1208
1209
1210
// Stmts can include decls, but we'll see the DeclId itself in a later
0 commit comments