From 0847156e8754c2ad0b1769a96f4949a7fb28e03f Mon Sep 17 00:00:00 2001 From: Mark Rowe Date: Mon, 25 Aug 2025 15:59:03 -0700 Subject: [ObjC] Correctly decode block pointers in the method type encoding The compiler represents block parameters as `@?` in the method type encoding string. We had been parsing this as two separate parameters (one `id` and one unknown type that was mapped to `void*`), resulting in some Objective-C method implementations incorrectly having an extra parameter. We cannot represent a Clang block (e.g., `void (^)()`) in the type system at present. Since these are Objective-C compatible types the simplest solution for now is to represent them as `id`. --- objectivec/objc.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'objectivec') diff --git a/objectivec/objc.cpp b/objectivec/objc.cpp index 4e36c9ed..1da2cb34 100644 --- a/objectivec/objc.cpp +++ b/objectivec/objc.cpp @@ -340,6 +340,14 @@ std::vector ObjCProcessor::ParseEncodedType(const std::stri qualifiedName = "objc_class_t"; break; case '?': + if (last == '@') + { + // A pointer to a Clang block is encoded as `@?`. For now we continue to represent this + // as `id` as we cannot represent block types. + last = c; + continue; + } + [[fallthrough]]; case 'T': nameOrType.type = Type::PointerType(8, Type::VoidType()); break; -- cgit v1.3.1