Index: lib/CodeGen/CGDeclCXX.cpp =================================================================== --- lib/CodeGen/CGDeclCXX.cpp +++ lib/CodeGen/CGDeclCXX.cpp @@ -246,7 +246,8 @@ CodeGenFunction CGF(CGM); CGF.StartFunction(GlobalDecl(&VD, DynamicInitKind::AtExit), - CGM.getContext().VoidTy, fn, FI, FunctionArgList()); + CGM.getContext().VoidTy, fn, FI, FunctionArgList(), + VD.getLocation(), VD.getInit()->getExprLoc()); llvm::CallInst *call = CGF.Builder.CreateCall(dtor, addr); Index: test/CodeGen/debug-info-no-location.cpp =================================================================== --- test/CodeGen/debug-info-no-location.cpp +++ test/CodeGen/debug-info-no-location.cpp @@ -0,0 +1,16 @@ +// RUN: %clang -cc1 -emit-llvm %s -gcodeview -debug-info-kind=limited -o - | FileCheck %s +// CHECK: call void @"??1?$c@UB@@@@QEAA@XZ"(%struct.c* @"?f@?1??d@@YAPEAU?$c@UB@@@@XZ@4U2@A"), !dbg !51 +// CHECK-NEXT: ret void, !dbg !51 +// CHECK: !48 = distinct !DISubprogram(name: "`dynamic atexit destructor for 'f'", scope: !3, file: !3, line: 16, type: !49, scopeLine: 16, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !27, retainedNodes: !29) +// CHECK: !51 = !DILocation(line: 16, scope: !48) + +struct a { + ~a(); +}; +template struct c : a { + c(void (b::*)()); +}; +struct B { + virtual void e(); +}; +c *d() { static c f(&B::e); return &f; }