diff options
| author | Mark Rowe <mark@vector35.com> | 2025-08-25 19:37:04 -0700 |
|---|---|---|
| committer | Mark Rowe <mark@vector35.com> | 2025-08-27 15:19:51 -0700 |
| commit | 86974363659160a4fa5ff1818e8e1317c74c9a0a (patch) | |
| tree | e75e9455dc6319129bd53994100efca2f25c8f85 /objectivec | |
| parent | 0847156e8754c2ad0b1769a96f4949a7fb28e03f (diff) | |
[ObjC] Fix parsing method type encoding strings for 32-bit platforms
Incorrect parsing of method type encoding strings was causing incorrect
function types to be applied to Objective-C method implementations. In
some cases this would result in confusion about which stack locations
specific parameters resided at.
`q`, `Q` and `d` were being mapped to `NSInteger`, `NSUInteger` and
`CGFloat` respectively. While this works for 64-bit platforms, the type
aliases refer to 32-bit types on 32-bit platforms. These type encodings
are explicitly for 64-bit types. To address this `q`, `Q` and `d` are
now mapped to `int64_t`, `uint64_t` and `double` respectively.
`l` and `L` were incorrectly being interpreted as `int64_t` and
`uint64_t`. While `long` is a 64-bit type on 64-bit Apple platforms, the
`l` / `L` type encodings always refer to a 32-bit type.
`S` was mistakenly being mapped to `uint8_t`. It is now `uint16_t` as
intended.
Diffstat (limited to 'objectivec')
| -rw-r--r-- | objectivec/objc.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/objectivec/objc.cpp b/objectivec/objc.cpp index 1da2cb34..a30a9ab6 100644 --- a/objectivec/objc.cpp +++ b/objectivec/objc.cpp @@ -295,7 +295,7 @@ std::vector<QualifiedNameOrType> ObjCProcessor::ParseEncodedType(const std::stri nameOrType.type = Type::IntegerType(2, true); break; case 'S': - nameOrType.type = Type::IntegerType(1, false); + nameOrType.type = Type::IntegerType(2, false); break; case 'i': nameOrType.type = Type::IntegerType(4, true); @@ -304,27 +304,27 @@ std::vector<QualifiedNameOrType> ObjCProcessor::ParseEncodedType(const std::stri nameOrType.type = Type::IntegerType(4, false); break; case 'l': - nameOrType.type = Type::IntegerType(8, true); + nameOrType.type = Type::IntegerType(4, true); break; case 'L': + nameOrType.type = Type::IntegerType(4, false); + break; + case 'q': nameOrType.type = Type::IntegerType(8, true); break; + case 'Q': + nameOrType.type = Type::IntegerType(8, false); + break; case 'f': - nameOrType.type = Type::IntegerType(4, true); + nameOrType.type = Type::FloatType(4); + break; + case 'd': + nameOrType.type = Type::FloatType(8); break; case 'b': case 'B': nameOrType.type = Type::BoolType(); break; - case 'q': - qualifiedName = "NSInteger"; - break; - case 'Q': - qualifiedName = "NSUInteger"; - break; - case 'd': - qualifiedName = "CGFloat"; - break; case '*': nameOrType.type = Type::PointerType(m_data->GetAddressSize(), Type::IntegerType(1, true)); break; |
