[lldb] Ignore type sugar in TypeSystemClang::GetPointerType
authorRaphael Isemann <teemperor@gmail.com>
Wed, 5 Feb 2020 10:44:28 +0000 (11:44 +0100)
committerRaphael Isemann <teemperor@gmail.com>
Wed, 5 Feb 2020 10:44:40 +0000 (11:44 +0100)
commit5ff4f881a7774b8ec8d4db40d2a6c95ddd8a5f21
treef11a25ed00864ec682223fb883c06aaf67025fe2
parent163e33b290ff4b3bc3eec569a153ced9267254ec
[lldb] Ignore type sugar in TypeSystemClang::GetPointerType

Summary:
Currently having a typedef for ObjC types is breaking member access in LLDB:
```
typedef NSString Str;
NSString *s; s.length; // OK
Str *s; s.length; // Causes: member reference base type 'Str *' (aka 'NSString *') is not a structure or union
```

This works for NSString as there the type building from `NSString` -> `NSString *` will correctly
build a ObjCObjectPointerType (which is necessary to make member access with a dot possible),
but for the typedef the `Str` -> `Str *` conversion will produce an incorrect PointerType. The reason
for this is that our check in TypeSystemClang::GetPointerType is not desugaring the base type,
which causes that `Str` is not recognised as a type to a `ObjCInterface` as the check only sees the
typedef sugar that was put around it. This causes that we fall back to constructing a PointerType
instead which does not allow member access with the dot operator.

This patch just changes the check to look at the desugared type instead.

Fixes rdar://17525603

Reviewers: shafik, mib

Reviewed By: mib

Subscribers: mib, JDevlieghere, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D73952
lldb/packages/Python/lldbsuite/test/lang/objc/objc-property/TestObjCProperty.py
lldb/packages/Python/lldbsuite/test/lang/objc/objc-property/main.m
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp