diff options
| author | Sean Callanan <scallanan@apple.com> | 2014-11-06 19:26:10 +0000 |
|---|---|---|
| committer | Sean Callanan <scallanan@apple.com> | 2014-11-06 19:26:10 +0000 |
| commit | 4c508df925dbb41b19317d4bb8871f6944114f0c (patch) | |
| tree | 9d40ea1b5db4377f7bf10ded4b979f64d1e3783f | |
| parent | bcdd304cbba065331eecfb00217421ded3724ae4 (diff) | |
| download | bcm5719-llvm-4c508df925dbb41b19317d4bb8871f6944114f0c.tar.gz bcm5719-llvm-4c508df925dbb41b19317d4bb8871f6944114f0c.zip | |
Handle types from the runtime that conform to
protocols.
<rdar://problem/18883778>
llvm-svn: 221476
3 files changed, 48 insertions, 1 deletions
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp index d5dba666dcf..9445fa56189 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp @@ -175,8 +175,18 @@ AppleObjCTypeEncodingParser::BuildObjCObjectPointerType (clang::ASTContext &ast_ 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? diff --git a/lldb/test/lang/objc/objc-ivar-protocols/TestIvarProtocols.py b/lldb/test/lang/objc/objc-ivar-protocols/TestIvarProtocols.py new file mode 100644 index 00000000000..356979f0248 --- /dev/null +++ b/lldb/test/lang/objc/objc-ivar-protocols/TestIvarProtocols.py @@ -0,0 +1,4 @@ +import lldbinline +import lldbtest + +lldbinline.MakeInlineTest(__file__, globals(), [lldbtest.skipIfFreeBSD,lldbtest.skipIfLinux,lldbtest.skipIfWindows]) diff --git a/lldb/test/lang/objc/objc-ivar-protocols/main.m b/lldb/test/lang/objc/objc-ivar-protocols/main.m new file mode 100644 index 00000000000..aa6c4715c33 --- /dev/null +++ b/lldb/test/lang/objc/objc-ivar-protocols/main.m @@ -0,0 +1,33 @@ +#import <Foundation/Foundation.h> + +@protocol MyProtocol +-(void)aMethod; +@end + +@interface MyClass : NSObject { + id <MyProtocol> myId; + NSObject <MyProtocol> *myObject; +}; + +-(void)doSomething; + +@end + +@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"]); +} + +@end + +int main () +{ + @autoreleasepool + { + MyClass *c = [MyClass alloc]; + [c doSomething]; + } +} |

