diff --git a/lldb/test/Shell/Expr/TestObjCHiddenIvars.test b/lldb/test/Shell/Expr/TestObjCHiddenIvars.test new file mode 100644 index 0000000000000..18c496e4d2d27 --- /dev/null +++ b/lldb/test/Shell/Expr/TestObjCHiddenIvars.test @@ -0,0 +1,65 @@ +# REQUIRES: system-darwin +# +# Tests that LLDB correctly finds the implementation +# DIE (with a `DW_AT_APPLE_objc_complete_type`) +# given an interface DIE (without said attribute). +# +# RUN: split-file %s %t +# RUN: %clangxx_host %t/lib.m -c -g -o %t/lib.o +# RUN: %clangxx_host %t/main.m -c -g -o %t/main.o +# RUN: %clangxx_host %t/main.o %t/lib.o -o %t/a.out -framework Foundation +# +# RUN: %lldb %t/a.out \ +# RUN: -o "breakpoint set -p 'return' -X main" \ +# RUN: -o run \ +# RUN: -o "expression *f" \ +# RUN: -o exit | FileCheck %s + +# CHECK: (lldb) expression *f +# CHECK: (Foo) ${{[0-9]+}} = { +# CHECK: y = 2 +# CHECK-NEXT: i = 1 + +#--- main.m +#import +#import "lib.h" + +extern Foo * func(); + +int main() { + Foo * f = func(); + return 0; +} + +#--- lib.m +#import +#import "lib.h" + +@implementation Foo { +int i; +} + +- (id)init { + self->i = 1; + self->y = 2; + + return self; +} +@end + +Foo * func() { + return [[Foo alloc] init]; +} + +#--- lib.h +#ifndef LIB_H_IN +#define LIB_H_IN + +#import + +@interface Foo : NSObject { +int y; +} +@end + +#endif // _H_IN