From 249d639786440747685b00e1a06ed1dcd69d052c Mon Sep 17 00:00:00 2001 From: Enrico Granata Date: Thu, 23 Oct 2014 21:15:20 +0000 Subject: [PATCH] Fix a problem where an SBType was advertising its static type class even though a dynamic type was available. Solves rdar://18744420 llvm-svn: 220511 --- lldb/source/API/SBType.cpp | 2 +- .../sbtype_typeclass/TestSBTypeTypeClass.py | 3 ++ lldb/test/python_api/sbtype_typeclass/main.m | 34 ++++++++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 lldb/test/python_api/sbtype_typeclass/TestSBTypeTypeClass.py create mode 100644 lldb/test/python_api/sbtype_typeclass/main.m diff --git a/lldb/source/API/SBType.cpp b/lldb/source/API/SBType.cpp index 14835c3..189cf81 100644 --- a/lldb/source/API/SBType.cpp +++ b/lldb/source/API/SBType.cpp @@ -477,7 +477,7 @@ lldb::TypeClass SBType::GetTypeClass () { if (IsValid()) - return m_opaque_sp->GetClangASTType(false).GetTypeClass(); + return m_opaque_sp->GetClangASTType(true).GetTypeClass(); return lldb::eTypeClassInvalid; } diff --git a/lldb/test/python_api/sbtype_typeclass/TestSBTypeTypeClass.py b/lldb/test/python_api/sbtype_typeclass/TestSBTypeTypeClass.py new file mode 100644 index 0000000..a70d2ca --- /dev/null +++ b/lldb/test/python_api/sbtype_typeclass/TestSBTypeTypeClass.py @@ -0,0 +1,3 @@ +import lldbinline + +lldbinline.MakeInlineTest(__file__, globals()) diff --git a/lldb/test/python_api/sbtype_typeclass/main.m b/lldb/test/python_api/sbtype_typeclass/main.m new file mode 100644 index 0000000..599d361 --- /dev/null +++ b/lldb/test/python_api/sbtype_typeclass/main.m @@ -0,0 +1,34 @@ +//===-- main.m --------------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +#import + +@interface ThisClassTestsThings : NSObject +@end + +@implementation ThisClassTestsThings +- (int)doSomething { + + id s = self; + NSLog(@"%@",s); //% s = self.frame().FindVariable("s"); s.SetPreferDynamicValue(lldb.eDynamicCanRunTarget) + //% s_type = s.GetType() + //% typeClass = s_type.GetTypeClass() + //% condition = (typeClass == lldb.eTypeClassClass) or (typeClass ==lldb.eTypeClassObjCObject) or (typeClass == lldb.eTypeClassObjCInterface) or (typeClass == lldb.eTypeClassObjCObjectPointer) or (typeClass == lldb.eTypeClassPointer) + //% self.assertTrue(condition, "s has the wrong TypeClass") + return 0; +} +- (id)init { + return (self = [super init]); +} +@end + + +int main (int argc, char const *argv[]) +{ + return [[[ThisClassTestsThings alloc] init] doSomething]; +} -- 2.7.4