1// RUN: %clang --target=x86_64-apple-macosx -g -gmodules -Wno-objc-root-class \
2// RUN:    -fmodules -fmodules-cache-path=%t.cache \
3// RUN:    -c -o %t.o %s -I%S/Inputs
4// RUN: lldb-test symbols -dump-clang-ast %t.o | FileCheck --check-prefix CHECK-ANON-S1 %s
5// RUN: lldb-test symbols -dump-clang-ast %t.o | FileCheck --check-prefix CHECK-ANON-S2 %s
6// RUN: lldb-test symbols -dump-clang-ast %t.o | FileCheck %s
7// Verify that the owning module information from DWARF is preserved in the AST.
8
9@import A;
10
11Typedef t1;
12// RUN: lldb-test symbols -dump-clang-ast -find type --language=ObjC++ \
13// RUN:   -compiler-context 'Module:A,Typedef:Typedef' %t.o \
14// RUN:   | FileCheck %s --check-prefix=CHECK-TYPEDEF
15// CHECK-TYPEDEF: TypedefDecl {{.*}} imported in A Typedef
16
17TopLevelStruct s1;
18// RUN: lldb-test symbols -dump-clang-ast -find type --language=ObjC++ \
19// RUN:   -compiler-context 'Module:A,Struct:TopLevelStruct' %t.o \
20// RUN:   | FileCheck %s --check-prefix=CHECK-TOPLEVELSTRUCT
21// CHECK-TOPLEVELSTRUCT: CXXRecordDecl {{.*}} imported in A struct TopLevelStruct
22// CHECK-TOPLEVELSTRUCT: -FieldDecl {{.*}} in A a 'int'
23
24Struct s2;
25// CHECK-ANON-S1: CXXRecordDecl {{.*}} imported in A struct
26
27StructB s3;
28// CHECK-ANON-S2: CXXRecordDecl {{.*}} imported in A.B {{.*}} struct
29// CHECK-ANON-S2: -FieldDecl {{.*}} in A.B anon_field_b 'int'
30
31Nested s4;
32// CHECK-DAG: CXXRecordDecl {{.*}} imported in A struct Nested
33// CHECK-DAG: -FieldDecl {{.*}} in A fromb 'StructB'
34
35Enum e1;
36// CHECK-DAG: EnumDecl {{.*}} imported in A {{.*}} Enum_e
37// FIXME: -EnumConstantDecl {{.*}} imported in A a
38
39@implementation SomeClass {
40  int private_ivar;
41}
42@synthesize number = private_ivar;
43@end
44
45SomeClass *obj1;
46// RUN: lldb-test symbols -dump-clang-ast -find type --language=ObjC++ \
47// RUN:   -compiler-context 'Module:A,Struct:SomeClass' %t.o \
48// RUN:   | FileCheck %s --check-prefix=CHECK-OBJC
49// CHECK-OBJC: ObjCInterfaceDecl {{.*}} imported in A <undeserialized declarations> SomeClass
50// CHECK-OBJC-NEXT: |-ObjCIvarDecl
51// CHECK-OBJC-NEXT: |-ObjCMethodDecl 0x[[NUMBER:[0-9a-f]+]]{{.*}} imported in A
52// CHECK-OBJC-NEXT: `-ObjCPropertyDecl {{.*}} imported in A number 'int' readonly
53// CHECK-OBJC-NEXT:   `-getter ObjCMethod 0x[[NUMBER]] 'number'
54
55// Template specializations are not yet supported, so they lack the ownership info:
56Template<int> t2;
57// CHECK-DAG: ClassTemplateSpecializationDecl {{.*}} imported in A struct Template
58
59Namespace::InNamespace<int> t3;
60// CHECK-DAG: ClassTemplateSpecializationDecl {{.*}} imported in A struct InNamespace
61
62Namespace::AlsoInNamespace<int> t4;
63// CHECK-DAG: ClassTemplateSpecializationDecl {{.*}} imported in A.B struct AlsoInNamespace
64