Skip to content

Commit a62078e

Browse files
committed
Fix LLVM 22 FFI pointer resolution for forward-declared types
On LLVM 22 (no ElaboratedType), type.pointee.canonical.declaration resolves to the forward declaration cursor instead of the definition cursor. forward_declaration? returns true for types like B and C that have both a forward declaration AND a definition, incorrectly treating them as opaque. opaque_declaration? correctly distinguishes: it only returns true when there's no definition at all (like Opaque).
1 parent 21c14c1 commit a62078e

File tree

1 file changed

+1
-1
lines changed
  • lib/ruby-bindgen/generators/ffi

1 file changed

+1
-1
lines changed

lib/ruby-bindgen/generators/ffi/ffi.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ def pointer_to_forward_declaration?(type)
435435
decl = type.pointee.canonical.declaration
436436
return false if [:cursor_invalid_file, :cursor_no_decl_found].include?(decl.kind)
437437

438-
decl.forward_declaration?
438+
decl.opaque_declaration?
439439
end
440440

441441
def figure_ffi_type(type, context = nil)

0 commit comments

Comments
 (0)