Module Debugging: Add Objective-C testcases for anonymous tag decls. (NFC)

rdar://problem/24199640

llvm-svn: 258252
This commit is contained in:
Adrian Prantl 2016-01-19 23:42:56 +00:00
parent 43e0081740
commit 8c0e50519b
3 changed files with 75 additions and 0 deletions

View File

@ -18,8 +18,13 @@
@import DebugObjC;
#endif
TypedefUnion tdu;
TypedefEnum tde;
TypedefStruct tds;
int foo(ObjCClass *c) {
InnerEnum e = e0;
GlobalStruct.i = GlobalUnion.i = GlobalEnum;
[c instanceMethodWithInt: 0];
return [c property];
}
@ -30,6 +35,29 @@ int foo(ObjCClass *c) {
// CHECK-SAME: flags: DIFlagFwdDecl)
// CHECK-NOT: !DICompositeType(tag: DW_TAG_structure_type,
// CHECK: ![[MOD]] = !DIModule(scope: null, name: {{.*}}DebugObjC
// CHECK: !DIGlobalVariable(name: "GlobalUnion",
// CHECK-SAME: type: ![[GLOBAL_UNION:[0-9]+]]
// CHECK: ![[GLOBAL_UNION]] = !DICompositeType(tag: DW_TAG_union_type,
// CHECK-SAME: elements: !{{[0-9]+}})
// CHECK: !DIGlobalVariable(name: "GlobalStruct",
// CHECK-SAME: type: ![[GLOBAL_STRUCT:[0-9]+]]
// CHECK: ![[GLOBAL_STRUCT]] = !DICompositeType(tag: DW_TAG_structure_type,
// CHECK-SAME: elements: !{{[0-9]+}})
// CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "TypedefUnion",
// CHECK-SAME: baseType: ![[TD_UNION:.*]])
// CHECK: ![[TD_UNION]] = !DICompositeType(tag: DW_TAG_union_type,
// CHECK-SAME: flags: DIFlagFwdDecl)
// CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "TypedefEnum",
// CHECK-SAME: baseType: ![[TD_ENUM:.*]])
// CHECK: ![[TD_ENUM]] = !DICompositeType(tag: DW_TAG_enumeration_type,
// CHECK-SAME: flags: DIFlagFwdDecl)
// CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "TypedefStruct",
// CHECK-SAME: baseType: ![[TD_STRUCT:.*]])
// CHECK: ![[TD_STRUCT]] = !DICompositeType(tag: DW_TAG_structure_type,
// CHECK-SAME: flags: DIFlagFwdDecl)
// CHECK-NOT: !DICompositeType(tag: DW_TAG_structure_type,
// CHECK: !DICompositeType(tag: DW_TAG_enumeration_type,
// CHECK-SAME: scope: ![[MOD]],

View File

@ -22,3 +22,17 @@ typedef enum {
+ (InnerEnum)protocolMethod;
@end
struct FwdDeclared;
struct FwdDeclared {
int i;
};
struct PureForwardDecl;
typedef union { int i; } TypedefUnion;
typedef enum { e1 = 1 } TypedefEnum;
typedef struct { int i; } TypedefStruct;
union { int i; } GlobalUnion;
struct { int i; } GlobalStruct;
enum { e2 = 2 } GlobalEnum;

View File

@ -38,14 +38,47 @@
// MODULE-CHECK: !DICompositeType(tag: DW_TAG_enumeration_type,
// MODULE-CHECK-SAME: scope: ![[MODULE:[0-9]+]],
// MODULE-CHECK: ![[MODULE]] = !DIModule(scope: null, name: "DebugObjC"
// MODULE-CHECK: ![[TD_ENUM:.*]] = !DICompositeType(tag: DW_TAG_enumeration_type,
// MODULE-CHECK-SAME-NOT: name:
// MODULE-CHECK-SAME: elements:
// MODULE-CHECK: !DICompositeType(tag: DW_TAG_structure_type,
// MODULE-CHECK-SAME: name: "FwdDecl",
// MODULE-CHECK-SAME: scope: ![[MODULE]],
// MODULE-CHECK: !DICompositeType(tag: DW_TAG_structure_type,
// MODULE-CHECK-SAME: name: "ObjCClass",
// MODULE-CHECK-SAME: scope: ![[MODULE]],
// MODULE-CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "FwdDeclared"
// MODULE-CHECK-SAME: elements:
// MODULE-CHECK: ![[TD_UNION:.*]] = !DICompositeType(tag: DW_TAG_union_type,
// MODULE-CHECK-SAME-NOT: name:
// MODULE-CHECK-SAME: elements:
// MODULE-CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "TypedefUnion",
// MODULE-CHECK-SAME: baseType: ![[TD_UNION]])
// MODULE-CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "TypedefEnum",
// MODULE-CHECK-SAME: baseType: ![[TD_ENUM:.*]])
// MODULE-CHECK: ![[TD_STRUCT:.*]] = !DICompositeType(tag: DW_TAG_structure_type,
// MODULE-CHECK-SAME-NOT: name:
// MODULE-CHECK-SAME: elements:
// MODULE-CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "TypedefStruct",
// MODULE-CHECK-SAME: baseType: ![[TD_STRUCT]])
// MODULE-CHECK: !DICompositeType(tag: DW_TAG_union_type,
// MODULE-CHECK-SAME-NOT: name:
// MODULE-CHECK: !DICompositeType(tag: DW_TAG_structure_type,
// MODULE-CHECK-SAME-NOT: name:
// MODULE-CHECK: !DISubprogram(name: "+[ObjCClass classMethod]",
// MODULE-CHECK-SAME: scope: ![[MODULE]],
// The forward declaration should not be in the module scope.
// MODULE-CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "OpaqueData", file
// MODULE-CHECK-NEG-NOT: !DICompositeType(tag: DW_TAG_structure_type, name: "PureForwardDecl"