aganea created this revision. aganea added reviewers: rnk, aprantl. aganea added a project: clang.
Previously, when clang was compiled with -DLLVM_ENABLE_ASSERTIONS=ON, the attached test was yielding: inlinable function call in a function with debug info must have a !dbg location call void @"??1?$c@UB@@@@QEAA@XZ"(%struct.c* @"?f@?1??d@@YAPEAU?$c@UB@@@@XZ@4U2@A") fatal error: error in backend: Broken module found, compilation aborted! Stack dump: 0. Program arguments: <f:\svn\buildninja\bin\clang -cc1 -emit-llvm phoenix.cpp> -gcodeview -debug-info-kind=limited 1. <eof> parser at end of file 2. Per-function optimization Fixes PR43012 Repository: rC Clang https://reviews.llvm.org/D66328 Files: lib/CodeGen/CGDeclCXX.cpp test/CodeGen/debug-info-no-location.cpp 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 <typename b> struct c : a { + c(void (b::*)()); +}; +struct B { + virtual void e(); +}; +c<B> *d() { static c<B> f(&B::e); return &f; } 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 <typename b> struct c : a { + c(void (b::*)()); +}; +struct B { + virtual void e(); +}; +c<B> *d() { static c<B> f(&B::e); return &f; } 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);
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits