[Lldb-commits] [PATCH] D73952: [lldb] Ignore type sugar in TypeSystemClang::GetPointerType

Raphael Isemann via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Feb 5 02:47:59 PST 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG5ff4f881a777: [lldb] Ignore type sugar in TypeSystemClang::GetPointerType (authored by teemperor).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73952/new/

https://reviews.llvm.org/D73952

Files:
  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


Index: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
===================================================================
--- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -4259,8 +4259,7 @@
   if (type) {
     clang::QualType qual_type(GetQualType(type));
 
-    const clang::Type::TypeClass type_class = qual_type->getTypeClass();
-    switch (type_class) {
+    switch (qual_type.getDesugaredType(getASTContext())->getTypeClass()) {
     case clang::Type::ObjCObject:
     case clang::Type::ObjCInterface:
       return GetType(getASTContext().getObjCObjectPointerType(qual_type));
Index: lldb/packages/Python/lldbsuite/test/lang/objc/objc-property/main.m
===================================================================
--- lldb/packages/Python/lldbsuite/test/lang/objc/objc-property/main.m
+++ lldb/packages/Python/lldbsuite/test/lang/objc/objc-property/main.m
@@ -87,10 +87,13 @@
 }
 @end
 
+typedef BaseClass TypedefBaseClass;
+
 int
 main ()
 {
   BaseClass *mine = [BaseClass baseClassWithBackedInt: 10 andUnbackedInt: 20];
+  TypedefBaseClass *typedefd = mine;
   
   // Set a breakpoint here.
   int nonexistant = mine.nonexistantInt;
Index: lldb/packages/Python/lldbsuite/test/lang/objc/objc-property/TestObjCProperty.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/lang/objc/objc-property/TestObjCProperty.py
+++ lldb/packages/Python/lldbsuite/test/lang/objc/objc-property/TestObjCProperty.py
@@ -110,6 +110,11 @@
         self.assertTrue(backed_value.GetValueAsUnsigned(12345)
                         == backing_value.GetValueAsUnsigned(23456))
 
+        value_from_typedef = frame.EvaluateExpression("typedefd.backedInt", False)
+        self.assertTrue(value_from_typedef.GetError().Success())
+        self.assertEqual(value_from_typedef.GetValueAsUnsigned(12345),
+                         backing_value.GetValueAsUnsigned(23456))
+
         unbacked_value = frame.EvaluateExpression("mine.unbackedInt", False)
         unbacked_error = unbacked_value.GetError()
         self.assertTrue(unbacked_error.Success())


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73952.242542.patch
Type: text/x-patch
Size: 2185 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200205/6a8e3a60/attachment-0001.bin>


More information about the lldb-commits mailing list