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

source code of lldb/test/Shell/SymbolFile/DWARF/x86/module-ownership.mm