Skip to content

Commit

Permalink
Re-add "AndRetain" functions
Browse files Browse the repository at this point in the history
Specifically CMBufferQueueDequeueAndRetain and
CMBufferQueueDequeueIfDataReadyAndRetain.

Accidentally removed in 0cfd5fc.
  • Loading branch information
madsmtm committed Jan 9, 2025
1 parent 0cfd5fc commit e92bc5a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions crates/header-translator/src/stmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1587,9 +1587,10 @@ impl Stmt {
});

// Don't map `CFRetain`, `CFRelease`, `CFAutorelease`, as well
// as custom ones like as `CGColorRelease`.
// as custom ones like as `CGColorRelease`, but not things
// like `CMBufferQueueDequeueAndRetain`.
//
// Same as what Swift does:
// Roughly the same as what Swift does:
// <https://github.com/swiftlang/swift/blob/swift-6.0.3-RELEASE/lib/ClangImporter/ImportDecl.cpp#L8435-L8452>
//
// Users can achieve (almost) the same by using `CFRetained`
Expand All @@ -1598,9 +1599,10 @@ impl Stmt {
// Besides, these do not have the necessary memory management
// attributes (cf_consumed/cf_returns_retained), and as such
// cannot be mapped correctly without extra hacks.
if id.name.ends_with("Retain")
if (id.name.ends_with("Retain")
|| id.name.ends_with("Release")
|| id.name.ends_with("Autorelease")
|| id.name.ends_with("Autorelease"))
&& !id.name.ends_with("AndRetain")
{
if let Some((_, first_arg_ty)) = arguments.first() {
if first_arg_ty.is_cf_type() {
Expand Down
2 changes: 1 addition & 1 deletion generated

0 comments on commit e92bc5a

Please sign in to comment.