summaryrefslogtreecommitdiff
path: root/objectivec
diff options
context:
space:
mode:
authorMark Rowe <mark@vector35.com>2025-08-25 15:59:03 -0700
committerMark Rowe <mark@vector35.com>2025-08-27 15:19:51 -0700
commit0847156e8754c2ad0b1769a96f4949a7fb28e03f (patch)
treeb3a34c852b59badace822e7feb7e77507efbdbf2 /objectivec
parent0ef2fc2645b3b3e212d21c406fd79602a7e29990 (diff)
[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`.
Diffstat (limited to 'objectivec')
-rw-r--r--objectivec/objc.cpp8
1 files changed, 8 insertions, 0 deletions
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<QualifiedNameOrType> 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;