[all-commits] [llvm/llvm-project] 5ff4f8: [lldb] Ignore type sugar in TypeSystemClang::GetPo...

Raphael Isemann via All-commits all-commits at lists.llvm.org
Wed Feb 5 02:44:59 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 5ff4f881a7774b8ec8d4db40d2a6c95ddd8a5f21
      https://github.com/llvm/llvm-project/commit/5ff4f881a7774b8ec8d4db40d2a6c95ddd8a5f21
  Author: Raphael Isemann <teemperor at gmail.com>
  Date:   2020-02-05 (Wed, 05 Feb 2020)

  Changed paths:
    M lldb/packages/Python/lldbsuite/test/lang/objc/objc-property/TestObjCProperty.py
    M lldb/packages/Python/lldbsuite/test/lang/objc/objc-property/main.m
    M lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp

  Log Message:
  -----------
  [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




More information about the All-commits mailing list