[Lldb-commits] [lldb] r221476 - Handle types from the runtime that conform to
Sean Callanan
scallanan at apple.com
Thu Nov 6 11:26:11 PST 2014
Author: spyffe
Date: Thu Nov 6 13:26:10 2014
New Revision: 221476
URL: http://llvm.org/viewvc/llvm-project?rev=221476&view=rev
Log:
Handle types from the runtime that conform to
protocols.
<rdar://problem/18883778>
Added:
lldb/trunk/test/lang/objc/objc-ivar-protocols/
lldb/trunk/test/lang/objc/objc-ivar-protocols/TestIvarProtocols.py
lldb/trunk/test/lang/objc/objc-ivar-protocols/main.m
Modified:
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp
Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp?rev=221476&r1=221475&r2=221476&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp Thu Nov 6 13:26:10 2014
@@ -175,8 +175,18 @@ AppleObjCTypeEncodingParser::BuildObjCOb
if (type.NextIf('"'))
name = ReadQuotedString(type);
- if (for_expression && !name.empty() && name[0] != '<')
+ if (for_expression && !name.empty())
{
+ size_t less_than_pos = name.find_first_of('<');
+
+ if (less_than_pos != std::string::npos)
+ {
+ if (less_than_pos == 0)
+ return ast_ctx.getObjCIdType();
+ else
+ name.erase(less_than_pos);
+ }
+
TypeVendor *type_vendor = m_runtime.GetTypeVendor();
assert (type_vendor); // how are we parsing type encodings for expressions if a type vendor isn't in play?
Added: lldb/trunk/test/lang/objc/objc-ivar-protocols/TestIvarProtocols.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/objc/objc-ivar-protocols/TestIvarProtocols.py?rev=221476&view=auto
==============================================================================
--- lldb/trunk/test/lang/objc/objc-ivar-protocols/TestIvarProtocols.py (added)
+++ lldb/trunk/test/lang/objc/objc-ivar-protocols/TestIvarProtocols.py Thu Nov 6 13:26:10 2014
@@ -0,0 +1,4 @@
+import lldbinline
+import lldbtest
+
+lldbinline.MakeInlineTest(__file__, globals(), [lldbtest.skipIfFreeBSD,lldbtest.skipIfLinux,lldbtest.skipIfWindows])
Added: lldb/trunk/test/lang/objc/objc-ivar-protocols/main.m
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/objc/objc-ivar-protocols/main.m?rev=221476&view=auto
==============================================================================
--- lldb/trunk/test/lang/objc/objc-ivar-protocols/main.m (added)
+++ lldb/trunk/test/lang/objc/objc-ivar-protocols/main.m Thu Nov 6 13:26:10 2014
@@ -0,0 +1,33 @@
+#import <Foundation/Foundation.h>
+
+ at protocol MyProtocol
+-(void)aMethod;
+ at end
+
+ at interface MyClass : NSObject {
+ id <MyProtocol> myId;
+ NSObject <MyProtocol> *myObject;
+};
+
+-(void)doSomething;
+
+ at end
+
+ at implementation MyClass
+
+-(void)doSomething
+{
+ NSLog(@"Hello"); //% self.expect("expression -- myId", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["id"]);
+ //% self.expect("expression -- myObject", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["NSObject"]);
+}
+
+ at end
+
+int main ()
+{
+ @autoreleasepool
+ {
+ MyClass *c = [MyClass alloc];
+ [c doSomething];
+ }
+}
More information about the lldb-commits
mailing list