Index: lib/CodeGen/CGDebugInfo.cpp =================================================================== --- lib/CodeGen/CGDebugInfo.cpp +++ lib/CodeGen/CGDebugInfo.cpp @@ -1176,7 +1176,7 @@ RecordTy, MethodName, MethodLinkageName, MethodDefUnit, MethodLine, MethodTy, /*isLocalToUnit=*/false, /* isDefinition=*/false, Virtuality, VIndex, ContainingType, Flags, - CGM.getLangOpts().Optimize, nullptr, TParamsArray.get()); + CGM.getLangOpts().Optimize, TParamsArray.get()); SPCache[Method->getCanonicalDecl()].reset(SP); @@ -2479,7 +2479,7 @@ llvm::DISubprogram *SP = DBuilder.createTempFunctionFwdDecl( DContext, Name, LinkageName, Unit, Line, getOrCreateFunctionType(FD, FnType, Unit), !FD->isExternallyVisible(), - /* isDefinition = */ false, 0, Flags, CGM.getLangOpts().Optimize, nullptr, + /* isDefinition = */ false, 0, Flags, CGM.getLangOpts().Optimize, TParamsArray.get(), getFunctionDeclaration(FD)); const FunctionDecl *CanonDecl = cast(FD->getCanonicalDecl()); FwdDeclReplaceMap.emplace_back(std::piecewise_construct, @@ -2692,8 +2692,9 @@ llvm::DISubprogram *SP = DBuilder.createFunction( FDContext, Name, LinkageName, Unit, LineNo, getOrCreateFunctionType(D, FnType, Unit), Fn->hasInternalLinkage(), - true /*definition*/, ScopeLine, Flags, CGM.getLangOpts().Optimize, Fn, + true /*definition*/, ScopeLine, Flags, CGM.getLangOpts().Optimize, TParamsArray.get(), getFunctionDeclaration(D)); + Fn->setSubprogram(SP); // We might get here with a VarDecl in the case we're generating // code for the initialization of globals. Do not record these decls // as they will overwrite the actual VarDecl Decl in the cache. @@ -2745,9 +2746,8 @@ DBuilder.createFunction(FDContext, Name, LinkageName, Unit, LineNo, getOrCreateFunctionType(D, FnType, Unit), false /*internalLinkage*/, true /*definition*/, - ScopeLine, Flags, CGM.getLangOpts().Optimize, nullptr, - TParamsArray.get(), - getFunctionDeclaration(D)); + ScopeLine, Flags, CGM.getLangOpts().Optimize, + TParamsArray.get(), getFunctionDeclaration(D)); } void CGDebugInfo::EmitLocation(CGBuilderTy &Builder, SourceLocation Loc) { Index: test/CodeGen/debug-info-block-decl.c =================================================================== --- test/CodeGen/debug-info-block-decl.c +++ test/CodeGen/debug-info-block-decl.c @@ -5,7 +5,7 @@ // CHECK: define{{.*}}@main() // CHECK: store{{.*}}bitcast{{.*}}, !dbg ![[ASSIGNMENT:[0-9]+]] // CHECK: define {{.*}} @__main_block_invoke -// CHECK: dbg ![[BLOCK_ENTRY:[0-9]+]] +// CHECK: , !dbg ![[BLOCK_ENTRY:[0-9]+]] int main() { Index: test/CodeGenCXX/debug-info-static-fns.cpp =================================================================== --- test/CodeGenCXX/debug-info-static-fns.cpp +++ test/CodeGenCXX/debug-info-static-fns.cpp @@ -7,7 +7,7 @@ } // Verify that a is present and mangled. -// CHECK: !DISubprogram(name: "a", linkageName: "_ZN1AL1aEi", +// CHECK: define internal i32 @_ZN1AL1aEi({{.*}} !dbg [[DBG:![0-9]+]] +// CHECK: [[DBG]] = distinct !DISubprogram(name: "a", linkageName: "_ZN1AL1aEi", // CHECK-SAME: line: 4 // CHECK-SAME: isDefinition: true -// CHECK-SAME: function: i32 (i32)* @_ZN1AL1aEi Index: test/CodeGenCXX/debug-info-windows-dtor.cpp =================================================================== --- test/CodeGenCXX/debug-info-windows-dtor.cpp +++ test/CodeGenCXX/debug-info-windows-dtor.cpp @@ -14,9 +14,9 @@ template struct AB; -// CHECK-LABEL: define {{.*}}@"\01??_E?$AB@H@@W3AEPAXI@Z" +// CHECK: define {{.*}}@"\01??_E?$AB@H@@W3AEPAXI@Z"({{.*}} !dbg [[THUNK_VEC_DEL_DTOR:![0-9]*]] // CHECK: call {{.*}}@"\01??_G?$AB@H@@UAEPAXI@Z"({{.*}}) #{{[0-9]*}}, !dbg [[THUNK_LOC:![0-9]*]] -// CHECK-LABEL: define +// CHECK: define -// CHECK: [[THUNK_VEC_DEL_DTOR:![0-9]*]] = distinct !DISubprogram({{.*}}function: {{.*}}@"\01??_E?$AB@H@@W3AEPAXI@Z" +// CHECK: [[THUNK_VEC_DEL_DTOR]] = distinct !DISubprogram // CHECK: [[THUNK_LOC]] = !DILocation(line: 15, scope: [[THUNK_VEC_DEL_DTOR]]) Index: test/CodeGenCXX/globalinit-loc.cpp =================================================================== --- test/CodeGenCXX/globalinit-loc.cpp +++ test/CodeGenCXX/globalinit-loc.cpp @@ -4,7 +4,7 @@ // Verify that the global init helper function does not get associated // with any source location. // -// CHECK: define internal {{.*}}void @_GLOBAL__sub_I_globalinit_loc.cpp +// CHECK: define internal {{.*}}void @_GLOBAL__sub_I_globalinit_loc.cpp({{.*}} { // CHECK: !dbg ![[DBG:.*]] // CHECK: !DISubprogram(linkageName: "_GLOBAL__sub_I_globalinit_loc.cpp" // CHECK-NOT: line: Index: test/CodeGenCXX/linetable-virtual-variadic.cpp =================================================================== --- test/CodeGenCXX/linetable-virtual-variadic.cpp +++ test/CodeGenCXX/linetable-virtual-variadic.cpp @@ -10,7 +10,7 @@ void Derived::VariadicFunction(...) { } -// CHECK-LABEL: define void @_ZN7Derived16VariadicFunctionEz( +// CHECK: define void @_ZN7Derived16VariadicFunctionEz({{.*}} !dbg ![[SP:[0-9]+]] // CHECK: ret void, !dbg ![[LOC:[0-9]+]] // CHECK-LABEL: define void @_ZT{{.+}}N7Derived16VariadicFunctionEz( // CHECK: ret void, !dbg ![[LOC:[0-9]+]] @@ -18,6 +18,6 @@ // CHECK: !llvm.dbg.cu = !{![[CU:[0-9]+]]} // // CHECK: ![[CU]] = distinct !DICompileUnit({{.*}} subprograms: ![[SPs:[0-9]+]] -// CHECK: ![[SPs]] = !{![[SP:[0-9]+]]} -// CHECK: ![[SP]] = distinct !DISubprogram(name: "VariadicFunction",{{.*}} function: {{[^:]+}} @_ZN7Derived16VariadicFunctionEz +// CHECK: ![[SPs]] = !{![[SP]]} +// CHECK: ![[SP]] = distinct !DISubprogram(name: "VariadicFunction" // CHECK: ![[LOC]] = !DILocation({{.*}}scope: ![[SP]]) Index: test/CodeGenObjCXX/property-objects.mm =================================================================== --- test/CodeGenObjCXX/property-objects.mm +++ test/CodeGenObjCXX/property-objects.mm @@ -37,7 +37,7 @@ // Don't attach debug locations to the prologue instructions. These were // leaking over from the previous function emission by accident. -// CHECK: define internal void @"\01-[I setBounds:]" +// CHECK: define internal void @"\01-[I setBounds:]"({{.*}} { // CHECK-NOT: !dbg // CHECK: call void @llvm.dbg.declare - (void)setFrame:(CGRect)frameRect {}