diff options
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]; + } +} |

