diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 4b7657bb3528..54b5f2fc4215 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -2793,11 +2793,11 @@ void CGDebugInfo::EmitFunctionDecl(GlobalDecl GD, SourceLocation Loc, unsigned LineNo = getLineNumber(Loc); unsigned ScopeLine = 0; - DBuilder.createFunction(FDContext, Name, LinkageName, Unit, LineNo, - getOrCreateFunctionType(D, FnType, Unit), - false /*internalLinkage*/, true /*definition*/, - ScopeLine, Flags, CGM.getLangOpts().Optimize, - TParamsArray.get(), getFunctionDeclaration(D)); + DBuilder.retainType(DBuilder.createFunction( + FDContext, Name, LinkageName, Unit, LineNo, + getOrCreateFunctionType(D, FnType, Unit), false /*internalLinkage*/, + false /*definition*/, ScopeLine, Flags, CGM.getLangOpts().Optimize, + TParamsArray.get(), getFunctionDeclaration(D))); } void CGDebugInfo::EmitLocation(CGBuilderTy &Builder, SourceLocation Loc) { diff --git a/clang/test/CodeGen/debug-info-scope-file.c b/clang/test/CodeGen/debug-info-scope-file.c index 296ec05826f5..94123bbc4935 100644 --- a/clang/test/CodeGen/debug-info-scope-file.c +++ b/clang/test/CodeGen/debug-info-scope-file.c @@ -6,8 +6,8 @@ // CHECK: ret void, !dbg [[F1_LINE:![0-9]*]] // CHECK: ret void, !dbg [[F2_LINE:![0-9]*]] // CHECK: [[F1:![0-9]*]] = distinct !DISubprogram(name: "f1",{{.*}} isDefinition: true -// CHECK: [[F2:![0-9]*]] = distinct !DISubprogram(name: "f2",{{.*}} isDefinition: true // CHECK: [[F1_LINE]] = !DILocation({{.*}}, scope: [[F1]]) +// CHECK: [[F2:![0-9]*]] = distinct !DISubprogram(name: "f2",{{.*}} isDefinition: true // CHECK: [[F2_LINE]] = !DILocation({{.*}}, scope: [[F2]]) void f1() { diff --git a/clang/test/CodeGen/debug-info.c b/clang/test/CodeGen/debug-info.c index d122e7fe5cc7..f0215cc92329 100644 --- a/clang/test/CodeGen/debug-info.c +++ b/clang/test/CodeGen/debug-info.c @@ -7,7 +7,7 @@ void convert(void) { // PR2784 -struct OPAQUE; // CHECK: DW_TAG_structure_type +struct OPAQUE; // CHECK-DAG: DW_TAG_structure_type, name: "OPAQUE" typedef struct OPAQUE *PTR; PTR p; @@ -42,19 +42,19 @@ struct foo2 foo2; // Radar 7325611 -// CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "barfoo" +// CHECK-DAG: !DIDerivedType(tag: DW_TAG_typedef, name: "barfoo" typedef int barfoo; barfoo foo() { } -// CHECK: __uint128_t +// CHECK-DAG: __uint128_t __uint128_t foo128 () { __uint128_t int128 = 44; return int128; } -// CHECK: uint64x2_t +// CHECK-DAG: uint64x2_t typedef unsigned long long uint64_t; typedef uint64_t uint64x2_t __attribute__((ext_vector_type(2))); uint64x2_t extvectbar[4]; diff --git a/clang/test/CodeGenCXX/PR20038.cpp b/clang/test/CodeGenCXX/PR20038.cpp index 2d7043dcda33..095705f389bf 100644 --- a/clang/test/CodeGenCXX/PR20038.cpp +++ b/clang/test/CodeGenCXX/PR20038.cpp @@ -7,8 +7,8 @@ extern bool b; // CHECK: call {{.*}}, !dbg [[DTOR_CALL1_LOC:![0-9]*]] // CHECK: call {{.*}}, !dbg [[DTOR_CALL2_LOC:![0-9]*]] // CHECK: [[FUN1:.*]] = distinct !DISubprogram(name: "fun1",{{.*}} isDefinition: true -// CHECK: [[FUN2:.*]] = distinct !DISubprogram(name: "fun2",{{.*}} isDefinition: true // CHECK: [[DTOR_CALL1_LOC]] = !DILocation(line: [[@LINE+1]], scope: [[FUN1]]) void fun1() { b && (C(), 1); } +// CHECK: [[FUN2:.*]] = distinct !DISubprogram(name: "fun2",{{.*}} isDefinition: true // CHECK: [[DTOR_CALL2_LOC]] = !DILocation(line: [[@LINE+1]], scope: [[FUN2]]) bool fun2() { return (C(), b) && 0; } diff --git a/clang/test/CodeGenCXX/debug-info-anon-union-vars.cpp b/clang/test/CodeGenCXX/debug-info-anon-union-vars.cpp index 5b0370eb749d..80742250d841 100644 --- a/clang/test/CodeGenCXX/debug-info-anon-union-vars.cpp +++ b/clang/test/CodeGenCXX/debug-info-anon-union-vars.cpp @@ -44,8 +44,8 @@ void instantiate(int x) { buildBytes(x); } -// CHECK: [[FILE:.*]] = !DIFile(filename: "{{.*}}debug-info-anon-union-vars.cpp", -// CHECK: !DIGlobalVariable(name: "c",{{.*}} file: [[FILE]], line: 6,{{.*}} isLocal: true, isDefinition: true +// CHECK: !DIGlobalVariable(name: "c",{{.*}} file: [[FILE:.*]], line: 6,{{.*}} isLocal: true, isDefinition: true +// CHECK: [[FILE]] = !DIFile(filename: "{{.*}}debug-info-anon-union-vars.cpp", // CHECK: !DIGlobalVariable(name: "d",{{.*}} file: [[FILE]], line: 6,{{.*}} isLocal: true, isDefinition: true // CHECK: !DIGlobalVariable(name: "a",{{.*}} file: [[FILE]], line: 6,{{.*}} isLocal: true, isDefinition: true // CHECK: !DIGlobalVariable(name: "b",{{.*}} file: [[FILE]], line: 6,{{.*}} isLocal: true, isDefinition: true diff --git a/clang/test/CodeGenCXX/debug-info-function-context.cpp b/clang/test/CodeGenCXX/debug-info-function-context.cpp index 24f9f1bda639..47a8d4d60214 100644 --- a/clang/test/CodeGenCXX/debug-info-function-context.cpp +++ b/clang/test/CodeGenCXX/debug-info-function-context.cpp @@ -26,11 +26,11 @@ int global_namespace_variable = 1; // function has the file as a context. // CHECK: ![[FILE:[0-9]+]] = !DIFile(filename: "{{.*}}context.cpp", +// CHECK: ![[NS:.*]] = !DINamespace(name: "ns" // CHECK: !DISubprogram(name: "member_function",{{.*}} scope: !"_ZTS1C",{{.*}} isDefinition: true // CHECK: !DISubprogram(name: "static_member_function",{{.*}} scope: !"_ZTS1C",{{.*}} isDefinition: true // CHECK: !DISubprogram(name: "global_function",{{.*}} scope: ![[FILE]],{{.*}} isDefinition: true -// CHECK: !DISubprogram(name: "global_namespace_function",{{.*}} scope: ![[NS:[0-9]+]],{{.*}} isDefinition: true -// CHECK: ![[NS]] = !DINamespace(name: "ns" +// CHECK: !DISubprogram(name: "global_namespace_function",{{.*}} scope: ![[NS]],{{.*}} isDefinition: true diff --git a/clang/test/CodeGenCXX/debug-info-namespace.cpp b/clang/test/CodeGenCXX/debug-info-namespace.cpp index bebb24ab5d63..5cdf91bc1bfa 100644 --- a/clang/test/CodeGenCXX/debug-info-namespace.cpp +++ b/clang/test/CodeGenCXX/debug-info-namespace.cpp @@ -67,10 +67,7 @@ void B::func_fwd() {} // CHECK: [[BAR:![0-9]+]] = !DICompositeType(tag: DW_TAG_structure_type, name: "bar", // CHECK-SAME: line: 6 // CHECK-SAME: DIFlagFwdDecl -// CHECK: [[F1:![0-9]+]] = distinct !DISubprogram(name: "f1",{{.*}} line: 4 -// CHECK-SAME: isDefinition: true -// CHECK: [[FUNC:![0-9]+]] = distinct !DISubprogram(name: "func",{{.*}} isDefinition: true -// CHECK: [[FUNC_FWD:![0-9]+]] = distinct !DISubprogram(name: "func_fwd",{{.*}} line: 47,{{.*}} isDefinition: true + // CHECK: [[I:![0-9]+]] = !DIGlobalVariable(name: "i",{{.*}} scope: [[NS]], // CHECK: [[VAR_FWD:![0-9]+]] = !DIGlobalVariable(name: "var_fwd",{{.*}} scope: [[NS]], // CHECK-SAME: line: 44 @@ -82,11 +79,15 @@ void B::func_fwd() {} // CHECK: [[M3]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, name: "E", scope: [[CU]], entity: [[CTXT]], line: 19) // CHECK: [[M4]] = !DIImportedEntity(tag: DW_TAG_imported_module, scope: [[LEX2:![0-9]+]], entity: [[NS]], line: 23) // CHECK: [[LEX2]] = distinct !DILexicalBlock(scope: [[LEX1:![0-9]+]], file: [[FOOCPP]], -// CHECK: [[LEX1]] = distinct !DILexicalBlock(scope: [[FUNC]], file: [[FOOCPP]], +// CHECK: [[LEX1]] = distinct !DILexicalBlock(scope: [[FUNC:![0-9]+]], file: [[FOOCPP]], +// CHECK: [[FUNC]] = distinct !DISubprogram(name: "func",{{.*}} isDefinition: true + // CHECK: [[M5]] = !DIImportedEntity(tag: DW_TAG_imported_module, scope: [[FUNC]], entity: [[CTXT]], // CHECK: [[M6]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: [[FUNC]], entity: [[FOO:!"_ZTSN1A1B3fooE"]], line: 27) // CHECK: [[M7]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: [[FUNC]], entity: [[BAR:!"_ZTSN1A1B3barE"]] -// CHECK: [[M8]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: [[FUNC]], entity: [[F1]] +// CHECK: [[M8]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: [[FUNC]], entity: [[F1:![0-9]+]] +// CHECK: [[F1:![0-9]+]] = distinct !DISubprogram(name: "f1",{{.*}} line: 4 +// CHECK-SAME: isDefinition: true // CHECK: [[M9]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: [[FUNC]], entity: [[I]] // CHECK: [[M10]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: [[FUNC]], entity: [[BAZ:![0-9]+]] // CHECK: [[BAZ]] = !DIDerivedType(tag: DW_TAG_typedef, name: "baz", scope: [[NS]], file: [[FOOCPP]], @@ -100,6 +101,7 @@ void B::func_fwd() {} // CHECK-SAME: scope: [[NS]], file: [[FOOCPP]], line: 9 // CHECK: [[M15]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: [[FUNC]], entity: [[VAR_FWD:![0-9]+]] // CHECK: [[M16]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: [[FUNC]], entity: [[FUNC_FWD:![0-9]+]] +// CHECK: [[FUNC_FWD]] = distinct !DISubprogram(name: "func_fwd",{{.*}} line: 47,{{.*}} isDefinition: true // CHECK: [[M17]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: [[CTXT]], entity: [[I]] // CHECK-GMLT: [[CU:![0-9]+]] = distinct !DICompileUnit( diff --git a/clang/test/CodeGenCXX/debug-info-ptr-to-member-function.cpp b/clang/test/CodeGenCXX/debug-info-ptr-to-member-function.cpp index cac16b600890..a7e02e481320 100644 --- a/clang/test/CodeGenCXX/debug-info-ptr-to-member-function.cpp +++ b/clang/test/CodeGenCXX/debug-info-ptr-to-member-function.cpp @@ -7,15 +7,15 @@ struct T { void foo(int (T::*method)()) {} -// A pointer to a member function is a pair of function- and this-pointer. -// CHECK: !DIDerivedType(tag: DW_TAG_ptr_to_member_type, -// DARWIN-X64-SAME: size: 128 -// WIN32-X64-SAME: size: 64 - struct Incomplete; int (Incomplete::**bar)(); +// A pointer to a member function is a pair of function- and this-pointer. // CHECK: !DIDerivedType(tag: DW_TAG_ptr_to_member_type, // DARWIN-X64-SAME: size: 128 // WIN32-X64-NOT: size: // CHECK-SAME: extraData: {{.*}}) + +// CHECK: !DIDerivedType(tag: DW_TAG_ptr_to_member_type, +// DARWIN-X64-SAME: size: 128 +// WIN32-X64-SAME: size: 64 diff --git a/clang/test/CodeGenCXX/debug-info-template-member.cpp b/clang/test/CodeGenCXX/debug-info-template-member.cpp index b94ff05df44e..a6ba82aa9432 100644 --- a/clang/test/CodeGenCXX/debug-info-template-member.cpp +++ b/clang/test/CodeGenCXX/debug-info-template-member.cpp @@ -50,15 +50,6 @@ inline int add3(int x) { // CHECK: [[ELEM_X]] = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !"_ZTS4elem" // CHECK-SAME: baseType: !"_ZTS4virtI4elemE" -// Check that the member function template specialization and implicit special -// members (the default ctor) refer to their class by scope, even though they -// didn't appear in the class's member list (C_MEM). This prevents the functions -// from being added to type units, while still appearing in the type -// declaration/reference in the compile unit. -// CHECK: !DISubprogram(name: "MyClass" -// CHECK-SAME: scope: !"_ZTS7MyClass" -// CHECK: !DISubprogram(name: "add<2>" -// CHECK-SAME: scope: !"_ZTS7MyClass" template struct outer { @@ -98,3 +89,13 @@ inline void f1() { void f2() { virt d; // emit 'virt' } + +// Check that the member function template specialization and implicit special +// members (the default ctor) refer to their class by scope, even though they +// didn't appear in the class's member list (C_MEM). This prevents the functions +// from being added to type units, while still appearing in the type +// declaration/reference in the compile unit. +// CHECK: !DISubprogram(name: "MyClass" +// CHECK-SAME: scope: !"_ZTS7MyClass" +// CHECK: !DISubprogram(name: "add<2>" +// CHECK-SAME: scope: !"_ZTS7MyClass" diff --git a/clang/test/CodeGenCXX/debug-info.cpp b/clang/test/CodeGenCXX/debug-info.cpp index 29ed9e93156d..394d8792fd86 100644 --- a/clang/test/CodeGenCXX/debug-info.cpp +++ b/clang/test/CodeGenCXX/debug-info.cpp @@ -114,9 +114,6 @@ foo func(foo f) { // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "b" // CHECK-SAME: DIFlagFwdDecl -// CHECK: [[FUNC:![0-9]+]] = distinct !DISubprogram(name: "func", linkageName: "_ZN7pr147634funcENS_3fooE" -// CHECK-SAME: type: [[FUNC_TYPE:![0-9]*]] -// CHECK-SAME: isDefinition: true } void foo() { @@ -141,6 +138,10 @@ incomplete (*x)[3]; // CHECK-SAME: baseType: !"_ZTSN6pr960810incompleteE" } +// CHECK: [[FUNC:![0-9]+]] = distinct !DISubprogram(name: "func", linkageName: "_ZN7pr147634funcENS_3fooE" +// CHECK-SAME: type: [[FUNC_TYPE:![0-9]*]] +// CHECK-SAME: isDefinition: true + // For some reason function arguments ended up down here // CHECK: ![[F]] = !DILocalVariable(name: "f", arg: 1, scope: [[FUNC]] // CHECK-SAME: type: !"[[FOO]]" diff --git a/clang/test/CodeGenCXX/debug-lambda-expressions.cpp b/clang/test/CodeGenCXX/debug-lambda-expressions.cpp index a022fad1b6b9..3efdee54c98d 100644 --- a/clang/test/CodeGenCXX/debug-lambda-expressions.cpp +++ b/clang/test/CodeGenCXX/debug-lambda-expressions.cpp @@ -19,70 +19,6 @@ int d(int x) { D y[10]; return [x,y] { return y[x].x; }(); } // CHECK: ![[INT:[0-9]+]] = !DIBasicType(name: "int" -// A: 10 -// CHECK: ![[A_FUNC:.*]] = distinct !DISubprogram(name: "a"{{.*}}, line: [[A_LINE:[0-9]+]]{{.*}}, isDefinition: true - -// B: 14 -// CHECK: ![[B_FUNC:.*]] = distinct !DISubprogram(name: "b"{{.*}}, line: [[B_LINE:[0-9]+]]{{.*}}, isDefinition: true - -// C: 17 -// CHECK: ![[C_FUNC:.*]] = distinct !DISubprogram(name: "c"{{.*}}, line: [[C_LINE:[0-9]+]]{{.*}}, isDefinition: true - -// D: 18 -// CHECK: ![[D_FUNC:.*]] = distinct !DISubprogram(name: "d"{{.*}}, line: [[D_LINE:[0-9]+]]{{.*}}, isDefinition: true - - -// Back to A. -- 78 -// CHECK: ![[LAM_A:.*]] = !DICompositeType(tag: DW_TAG_class_type{{.*}}, scope: ![[A_FUNC]]{{.*}}, line: [[A_LINE]], -// CHECK-SAME: elements: ![[LAM_A_ARGS:[0-9]+]] -// CHECK: ![[LAM_A_ARGS]] = !{![[CON_LAM_A:[0-9]+]]} -// CHECK: ![[CON_LAM_A]] = !DISubprogram(name: "operator()" -// CHECK-SAME: scope: ![[LAM_A]] -// CHECK-SAME: line: [[A_LINE]] -// CHECK-SAME: DIFlagPublic - -// Back to B. -- 67 -// CHECK: ![[LAM_B:.*]] = !DICompositeType(tag: DW_TAG_class_type{{.*}}, scope: ![[B_FUNC]]{{.*}}, line: [[B_LINE]], -// CHECK-SAME: elements: ![[LAM_B_ARGS:[0-9]+]] -// CHECK: ![[LAM_B_ARGS]] = !{![[CAP_B:[0-9]+]], ![[CON_LAM_B:[0-9]+]]} -// CHECK: ![[CAP_B]] = !DIDerivedType(tag: DW_TAG_member, name: "x" -// CHECK-SAME: scope: ![[LAM_B]] -// CHECK-SAME: line: [[B_LINE]], -// CHECK-SAME: baseType: ![[INT]] -// CHECK: ![[CON_LAM_B]] = !DISubprogram(name: "operator()" -// CHECK-SAME: scope: ![[LAM_B]] -// CHECK-SAME: line: [[B_LINE]] -// CHECK-SAME: DIFlagPublic - -// Back to C. -- 55 -// CHECK: ![[LAM_C:.*]] = !DICompositeType(tag: DW_TAG_class_type{{.*}}, scope: ![[C_FUNC]]{{.*}}, line: [[C_LINE]], -// CHECK-SAME: elements: ![[LAM_C_ARGS:[0-9]+]] -// CHECK: ![[LAM_C_ARGS]] = !{![[CAP_C:[0-9]+]], ![[CON_LAM_C:[0-9]+]]} -// CHECK: ![[CAP_C]] = !DIDerivedType(tag: DW_TAG_member, name: "x" -// CHECK-SAME: scope: ![[LAM_C]] -// CHECK-SAME: line: [[C_LINE]], -// CHECK-SAME: baseType: ![[TYPE_C_x:[0-9]+]] -// CHECK: ![[TYPE_C_x]] = !DIDerivedType(tag: DW_TAG_reference_type, baseType: ![[INT]] -// CHECK: ![[CON_LAM_C]] = !DISubprogram(name: "operator()" -// CHECK-SAME: scope: ![[LAM_C]] -// CHECK-SAME: line: [[C_LINE]] -// CHECK-SAME: DIFlagPublic - -// Back to D. -- 24 -// CHECK: ![[LAM_D:.*]] = !DICompositeType(tag: DW_TAG_class_type{{.*}}, scope: ![[D_FUNC]]{{.*}}, line: [[D_LINE]], -// CHECK-SAME: elements: ![[LAM_D_ARGS:[0-9]+]] -// CHECK: ![[LAM_D_ARGS]] = !{![[CAP_D_X:[0-9]+]], ![[CAP_D_Y:[0-9]+]], ![[CON_LAM_D:[0-9]+]]} -// CHECK: ![[CAP_D_X]] = !DIDerivedType(tag: DW_TAG_member, name: "x" -// CHECK-SAME: scope: ![[LAM_D]] -// CHECK-SAME: line: [[D_LINE]], -// CHECK: ![[CAP_D_Y]] = !DIDerivedType(tag: DW_TAG_member, name: "y" -// CHECK-SAME: scope: ![[LAM_D]] -// CHECK-SAME: line: [[D_LINE]], -// CHECK: ![[CON_LAM_D]] = !DISubprogram(name: "operator()" -// CHECK-SAME: scope: ![[LAM_D]] -// CHECK-SAME: line: [[D_LINE]] -// CHECK-SAME: DIFlagPublic - // CVAR: // CHECK: !DIGlobalVariable(name: "cvar" // CHECK-SAME: line: [[CVAR_LINE:[0-9]+]] @@ -100,3 +36,66 @@ int d(int x) { D y[10]; return [x,y] { return y[x].x; }(); } // CHECK-SAME: line: [[VAR_LINE]], // CHECK-SAME: elements: ![[VAR_ARGS:[0-9]+]] // CHECK: ![[VAR_ARGS]] = !{!{{[0-9]+}}} + +// A: 10 +// CHECK: ![[A_FUNC:.*]] = distinct !DISubprogram(name: "a"{{.*}}, line: [[A_LINE:[0-9]+]]{{.*}}, isDefinition: true + +// Back to A. -- 78 +// CHECK: ![[LAM_A:.*]] = !DICompositeType(tag: DW_TAG_class_type{{.*}}, scope: ![[A_FUNC]]{{.*}}, line: [[A_LINE]], +// CHECK-SAME: elements: ![[LAM_A_ARGS:[0-9]+]] +// CHECK: ![[LAM_A_ARGS]] = !{![[CON_LAM_A:[0-9]+]]} +// CHECK: ![[CON_LAM_A]] = !DISubprogram(name: "operator()" +// CHECK-SAME: scope: ![[LAM_A]] +// CHECK-SAME: line: [[A_LINE]] +// CHECK-SAME: DIFlagPublic + +// B: 14 +// CHECK: ![[B_FUNC:.*]] = distinct !DISubprogram(name: "b"{{.*}}, line: [[B_LINE:[0-9]+]]{{.*}}, isDefinition: true + +// Back to B. -- 67 +// CHECK: ![[LAM_B:.*]] = !DICompositeType(tag: DW_TAG_class_type{{.*}}, scope: ![[B_FUNC]]{{.*}}, line: [[B_LINE]], +// CHECK-SAME: elements: ![[LAM_B_ARGS:[0-9]+]] +// CHECK: ![[LAM_B_ARGS]] = !{![[CAP_B:[0-9]+]], ![[CON_LAM_B:[0-9]+]]} +// CHECK: ![[CAP_B]] = !DIDerivedType(tag: DW_TAG_member, name: "x" +// CHECK-SAME: scope: ![[LAM_B]] +// CHECK-SAME: line: [[B_LINE]], +// CHECK-SAME: baseType: ![[INT]] +// CHECK: ![[CON_LAM_B]] = !DISubprogram(name: "operator()" +// CHECK-SAME: scope: ![[LAM_B]] +// CHECK-SAME: line: [[B_LINE]] +// CHECK-SAME: DIFlagPublic + +// C: 17 +// CHECK: ![[C_FUNC:.*]] = distinct !DISubprogram(name: "c"{{.*}}, line: [[C_LINE:[0-9]+]]{{.*}}, isDefinition: true + +// Back to C. -- 55 +// CHECK: ![[LAM_C:.*]] = !DICompositeType(tag: DW_TAG_class_type{{.*}}, scope: ![[C_FUNC]]{{.*}}, line: [[C_LINE]], +// CHECK-SAME: elements: ![[LAM_C_ARGS:[0-9]+]] +// CHECK: ![[LAM_C_ARGS]] = !{![[CAP_C:[0-9]+]], ![[CON_LAM_C:[0-9]+]]} +// CHECK: ![[CAP_C]] = !DIDerivedType(tag: DW_TAG_member, name: "x" +// CHECK-SAME: scope: ![[LAM_C]] +// CHECK-SAME: line: [[C_LINE]], +// CHECK-SAME: baseType: ![[TYPE_C_x:[0-9]+]] +// CHECK: ![[TYPE_C_x]] = !DIDerivedType(tag: DW_TAG_reference_type, baseType: ![[INT]] +// CHECK: ![[CON_LAM_C]] = !DISubprogram(name: "operator()" +// CHECK-SAME: scope: ![[LAM_C]] +// CHECK-SAME: line: [[C_LINE]] +// CHECK-SAME: DIFlagPublic + +// D: 18 +// CHECK: ![[D_FUNC:.*]] = distinct !DISubprogram(name: "d"{{.*}}, line: [[D_LINE:[0-9]+]]{{.*}}, isDefinition: true + +// Back to D. -- 24 +// CHECK: ![[LAM_D:.*]] = !DICompositeType(tag: DW_TAG_class_type{{.*}}, scope: ![[D_FUNC]]{{.*}}, line: [[D_LINE]], +// CHECK-SAME: elements: ![[LAM_D_ARGS:[0-9]+]] +// CHECK: ![[LAM_D_ARGS]] = !{![[CAP_D_X:[0-9]+]], ![[CAP_D_Y:[0-9]+]], ![[CON_LAM_D:[0-9]+]]} +// CHECK: ![[CAP_D_X]] = !DIDerivedType(tag: DW_TAG_member, name: "x" +// CHECK-SAME: scope: ![[LAM_D]] +// CHECK-SAME: line: [[D_LINE]], +// CHECK: ![[CAP_D_Y]] = !DIDerivedType(tag: DW_TAG_member, name: "y" +// CHECK-SAME: scope: ![[LAM_D]] +// CHECK-SAME: line: [[D_LINE]], +// CHECK: ![[CON_LAM_D]] = !DISubprogram(name: "operator()" +// CHECK-SAME: scope: ![[LAM_D]] +// CHECK-SAME: line: [[D_LINE]] +// CHECK-SAME: DIFlagPublic diff --git a/clang/test/CodeGenCXX/debug-lambda-this.cpp b/clang/test/CodeGenCXX/debug-lambda-this.cpp index 0c413449a3ec..e7ea68c1a35d 100644 --- a/clang/test/CodeGenCXX/debug-lambda-this.cpp +++ b/clang/test/CodeGenCXX/debug-lambda-this.cpp @@ -12,10 +12,10 @@ int D::d(int x) { }(); } +// CHECK: ![[POINTER:.*]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !"_ZTS1D", size: 64, align: 64) // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "this", // CHECK-SAME: line: 11 -// CHECK-SAME: baseType: ![[POINTER:[0-9]+]] +// CHECK-SAME: baseType: ![[POINTER]] // CHECK-SAME: size: 64, align: 64 // CHECK-NOT: offset: 0 // CHECK-SAME: ){{$}} -// CHECK: ![[POINTER]] = !DIDerivedType(tag: DW_TAG_pointer_type diff --git a/clang/test/CodeGenCXX/linetable-virtual-variadic.cpp b/clang/test/CodeGenCXX/linetable-virtual-variadic.cpp index 8d1bf47814f8..6f966416867a 100644 --- a/clang/test/CodeGenCXX/linetable-virtual-variadic.cpp +++ b/clang/test/CodeGenCXX/linetable-virtual-variadic.cpp @@ -15,9 +15,5 @@ void Derived::VariadicFunction(...) { } // CHECK-LABEL: define void @_ZT{{.+}}N7Derived16VariadicFunctionEz( // CHECK: ret void, !dbg ![[LOC:[0-9]+]] // -// CHECK: !llvm.dbg.cu = !{![[CU:[0-9]+]]} -// -// CHECK: ![[CU]] = distinct !DICompileUnit({{.*}} subprograms: ![[SPs:[0-9]+]] -// CHECK: ![[SPs]] = !{![[SP]]} // CHECK: ![[SP]] = distinct !DISubprogram(name: "VariadicFunction" // CHECK: ![[LOC]] = !DILocation({{.*}}scope: ![[SP]]) diff --git a/clang/test/CodeGenObjC/debug-info-block-type.m b/clang/test/CodeGenObjC/debug-info-block-type.m index 1f137ed9dfc2..565bc86e8b8a 100644 --- a/clang/test/CodeGenObjC/debug-info-block-type.m +++ b/clang/test/CodeGenObjC/debug-info-block-type.m @@ -1,18 +1,17 @@ // RUN: %clang_cc1 -emit-llvm -fblocks -debug-info-kind=limited -triple x86_64-apple-darwin14 -x objective-c < %s -o - | FileCheck %s -#define nil ((void*) 0) -typedef signed char BOOL; -// CHECK: ![[BOOL:[0-9]+]] = !DIDerivedType(tag: DW_TAG_typedef, name: "BOOL" -// CHECK-SAME: line: [[@LINE-2]] -// CHECK: ![[ID:[0-9]+]] = !DIDerivedType(tag: DW_TAG_typedef, name: "id" - -typedef BOOL (^SomeKindOfPredicate)(id obj); // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "__FuncPtr" // CHECK-SAME: baseType: ![[PTR:[0-9]+]] // CHECK: ![[PTR]] = !DIDerivedType(tag: DW_TAG_pointer_type, // CHECK-SAME: baseType: ![[FNTYPE:[0-9]+]] // CHECK: ![[FNTYPE]] = !DISubroutineType(types: ![[ARGS:[0-9]+]]) -// CHECK: ![[ARGS]] = !{![[BOOL]], ![[ID]]} +// CHECK: ![[ARGS]] = !{![[BOOL:.*]], ![[ID:.*]]} +#define nil ((void*) 0) +typedef signed char BOOL; +// CHECK: ![[BOOL]] = !DIDerivedType(tag: DW_TAG_typedef, name: "BOOL" +// CHECK-SAME: line: [[@LINE-2]] +// CHECK: ![[ID]] = !DIDerivedType(tag: DW_TAG_typedef, name: "id" +typedef BOOL (^SomeKindOfPredicate)(id obj); int main() { SomeKindOfPredicate p = ^BOOL(id obj) { return obj != nil; }; diff --git a/clang/test/CodeGenObjC/debug-property-synth.m b/clang/test/CodeGenObjC/debug-property-synth.m index 74ee775f751a..45bf77067c86 100644 --- a/clang/test/CodeGenObjC/debug-property-synth.m +++ b/clang/test/CodeGenObjC/debug-property-synth.m @@ -19,8 +19,8 @@ // CHECK: load {{.*}}, !dbg ![[DBG2:[0-9]+]] // // CHECK: !DISubprogram(name: "-[I p1]",{{.*}} line: [[@LINE+4]],{{.*}} isLocal: true, isDefinition: true -// CHECK: !DISubprogram(name: "-[I setP1:]",{{.*}} line: [[@LINE+3]],{{.*}} isLocal: true, isDefinition: true -// CHECK: ![[DBG1]] = !DILocation(line: [[@LINE+2]], +// CHECK: ![[DBG1]] = !DILocation(line: [[@LINE+3]], +// CHECK: !DISubprogram(name: "-[I setP1:]",{{.*}} line: [[@LINE+2]],{{.*}} isLocal: true, isDefinition: true // CHECK: ![[DBG2]] = !DILocation(line: [[@LINE+1]], @property int p1; @end diff --git a/clang/test/Modules/ExtDebugInfo.m b/clang/test/Modules/ExtDebugInfo.m index 5c3c7112b8ca..d758bfda8314 100644 --- a/clang/test/Modules/ExtDebugInfo.m +++ b/clang/test/Modules/ExtDebugInfo.m @@ -29,17 +29,12 @@ int foo(ObjCClass *c) { return [c property]; } -// CHECK-NOT: !DICompositeType(tag: DW_TAG_structure_type, -// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "ObjCClass", -// CHECK-SAME: scope: ![[MOD:[0-9]+]], -// 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: ![[MOD:.*]] = !DIModule(scope: null, name: "DebugObjC // 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, @@ -49,15 +44,21 @@ int foo(ObjCClass *c) { // 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: !DICompositeType(tag: DW_TAG_structure_type, name: "ObjCClass", +// CHECK-SAME: scope: ![[MOD]], +// CHECK-SAME: flags: DIFlagFwdDecl) + // CHECK-NOT: !DICompositeType(tag: DW_TAG_structure_type, // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, // CHECK-SAME: scope: ![[MOD]], diff --git a/clang/test/Modules/ModuleDebugInfo.cpp b/clang/test/Modules/ModuleDebugInfo.cpp index d0e304bb134c..027d08637e29 100644 --- a/clang/test/Modules/ModuleDebugInfo.cpp +++ b/clang/test/Modules/ModuleDebugInfo.cpp @@ -58,6 +58,9 @@ // CHECK-SAME: name: "Template >" // CHECK-SAME: identifier: "_ZTSN8DebugCXX8TemplateIfNS_6traitsIfEEEE") +// CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "B", +// no mangled name here yet. + // CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "FwdVirtual" // CHECK-SAME: elements: // CHECK-SAME: identifier: "_ZTS10FwdVirtual") @@ -81,9 +84,6 @@ // CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "FloatInstatiation" // no mangled name here yet. -// CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "B", -// no mangled name here yet. - // CHECK: !DICompositeType(tag: DW_TAG_union_type, // CHECK-NOT: name: // CHECK-SAME: ) diff --git a/clang/test/Modules/ModuleDebugInfo.m b/clang/test/Modules/ModuleDebugInfo.m index f7fcdc198029..02ae93feb796 100644 --- a/clang/test/Modules/ModuleDebugInfo.m +++ b/clang/test/Modules/ModuleDebugInfo.m @@ -35,11 +35,16 @@ // CHECK-SAME: elements: // CHECK-SAME: ) -// CHECK: !DICompositeType(tag: DW_TAG_structure_type, -// CHECK-SAME: name: "FwdDecl", +// CHECK: !DISubprogram(name: "+[ObjCClass classMethod]", +// CHECK-SAME: scope: ![[MODULE]], + +// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "ObjCClass", // CHECK-SAME: scope: ![[MODULE]], -// CHECK: !DICompositeType(tag: DW_TAG_structure_type, -// CHECK-SAME: name: "ObjCClass", + +// The forward declaration should not be in the module scope. +// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "OpaqueData", file + +// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "FwdDecl", // CHECK-SAME: scope: ![[MODULE]], // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "FwdDeclared" @@ -70,24 +75,16 @@ // CHECK-NOT: name: // CHECK-SAME: ) -// CHECK: !DISubprogram(name: "+[ObjCClass classMethod]", -// CHECK-SAME: scope: ![[MODULE]], - -// The forward declaration should not be in the module scope. -// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "OpaqueData", file - // CHECK-NEG-NOT: !DICompositeType(tag: DW_TAG_structure_type, name: "PureForwardDecl" // The output order is sublty different for module vs. pch, // so these are checked separately: // -// CHECK2: !DICompositeType(tag: DW_TAG_structure_type, -// CHECK2-SAME: name: "FwdDecl", -// CHECK2: !DICompositeType(tag: DW_TAG_structure_type, -// CHECK2-SAME: name: "ObjCClass", -// CHECK2: !DIObjCProperty(name: "property", -// CHECK2: !DIDerivedType(tag: DW_TAG_member, name: "ivar" -// CHECK2: !DIDerivedType(tag: DW_TAG_typedef, name: "InnerEnum" // CHECK2: !DISubprogram(name: "+[ObjCClass classMethod]" // CHECK2: !DISubprogram(name: "-[ObjCClass instanceMethodWithInt:]" +// CHECK2: !DICompositeType(tag: DW_TAG_structure_type, name: "ObjCClass", +// CHECK2: !DIObjCProperty(name: "property", +// CHECK2: !DIDerivedType(tag: DW_TAG_member, name: "ivar" // CHECK2: !DISubprogram(name: "-[Category(Category) categoryMethod]" +// CHECK2: !DICompositeType(tag: DW_TAG_structure_type, name: "FwdDecl", +// CHECK2: !DIDerivedType(tag: DW_TAG_typedef, name: "InnerEnum"