r369458 - [DebugInfo] Add debug location to dynamic atexit destructor
Hans Wennborg via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 22 02:06:21 PDT 2019
This broke the Chromium build, see
https://bugs.chromium.org/p/chromium/issues/detail?id=996618#c1 for a
reproducer.
I've reverted in r369633.
On Wed, Aug 21, 2019 at 12:08 AM Alexandre Ganea via cfe-commits
<cfe-commits at lists.llvm.org> wrote:
>
> Author: aganea
> Date: Tue Aug 20 15:09:49 2019
> New Revision: 369458
>
> URL: http://llvm.org/viewvc/llvm-project?rev=369458&view=rev
> Log:
> [DebugInfo] Add debug location to dynamic atexit destructor
>
> Fixes PR43012
>
> Differential Revision: https://reviews.llvm.org/D66328
>
> Added:
> cfe/trunk/test/CodeGenCXX/debug-info-atexit-stub.cpp
> Modified:
> cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
> cfe/trunk/lib/CodeGen/CGDeclCXX.cpp
> cfe/trunk/test/CodeGenCXX/debug-info-global-ctor-dtor.cpp
>
> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=369458&r1=369457&r2=369458&view=diff
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Tue Aug 20 15:09:49 2019
> @@ -3564,7 +3564,8 @@ void CGDebugInfo::EmitFunctionStart(Glob
> if (Name.startswith("\01"))
> Name = Name.substr(1);
>
> - if (!HasDecl || D->isImplicit() || D->hasAttr<ArtificialAttr>()) {
> + if (!HasDecl || D->isImplicit() || D->hasAttr<ArtificialAttr>() ||
> + (isa<VarDecl>(D) && GD.getDynamicInitKind() == DynamicInitKind::AtExit)) {
> Flags |= llvm::DINode::FlagArtificial;
> // Artificial functions should not silently reuse CurLoc.
> CurLoc = SourceLocation();
>
> Modified: cfe/trunk/lib/CodeGen/CGDeclCXX.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDeclCXX.cpp?rev=369458&r1=369457&r2=369458&view=diff
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CGDeclCXX.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGDeclCXX.cpp Tue Aug 20 15:09:49 2019
> @@ -247,6 +247,8 @@ llvm::Function *CodeGenFunction::createA
>
> CGF.StartFunction(GlobalDecl(&VD, DynamicInitKind::AtExit),
> CGM.getContext().VoidTy, fn, FI, FunctionArgList());
> + // Emit an artificial location for this function.
> + auto AL = ApplyDebugLocation::CreateArtificial(CGF);
>
> llvm::CallInst *call = CGF.Builder.CreateCall(dtor, addr);
>
>
> Added: cfe/trunk/test/CodeGenCXX/debug-info-atexit-stub.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-atexit-stub.cpp?rev=369458&view=auto
> ==============================================================================
> --- cfe/trunk/test/CodeGenCXX/debug-info-atexit-stub.cpp (added)
> +++ cfe/trunk/test/CodeGenCXX/debug-info-atexit-stub.cpp Tue Aug 20 15:09:49 2019
> @@ -0,0 +1,20 @@
> +// RUN: %clang_cc1 -emit-llvm %s -gcodeview -debug-info-kind=limited -o - | FileCheck %s
> +
> +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; }
> +
> +// CHECK: define internal void @"??__Ff@?1??d@@YAPEAU?$c at UB@@@@XZ at YAXXZ"()
> +// CHECK-SAME: !dbg ![[SUBPROGRAM:[0-9]+]] {
> +// CHECK: call void @"??1?$c at UB@@@@QEAA at XZ"(%struct.c* @"?f@?1??d@@YAPEAU?$c at UB@@@@XZ at 4U2@A"), !dbg ![[LOCATION:[0-9]+]]
> +// CHECK-NEXT: ret void, !dbg ![[LOCATION]]
> +// CHECK: ![[SUBPROGRAM]] = distinct !DISubprogram(name: "`dynamic atexit destructor for 'f'"
> +// CHECK-SAME: flags: DIFlagArtificial
> +// CHECK: ![[LOCATION]] = !DILocation(line: 0, scope: ![[SUBPROGRAM]])
>
> Modified: cfe/trunk/test/CodeGenCXX/debug-info-global-ctor-dtor.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-global-ctor-dtor.cpp?rev=369458&r1=369457&r2=369458&view=diff
> ==============================================================================
> --- cfe/trunk/test/CodeGenCXX/debug-info-global-ctor-dtor.cpp (original)
> +++ cfe/trunk/test/CodeGenCXX/debug-info-global-ctor-dtor.cpp Tue Aug 20 15:09:49 2019
> @@ -30,24 +30,24 @@ A FooTpl<T>::sdm_tpl(sizeof(U) + sizeof(
> template A FooTpl<int>::sdm_tpl<int>;
>
> // CHECK-NOKEXT: !DISubprogram(name: "__cxx_global_var_init",{{.*}} line: 15,{{.*}} DISPFlagLocalToUnit | DISPFlagDefinition
> -// CHECK-NOKEXT: !DISubprogram(name: "__dtor_glob",{{.*}} line: 15,{{.*}} DISPFlagLocalToUnit | DISPFlagDefinition
> +// CHECK-NOKEXT: !DISubprogram(name: "__dtor_glob",{{.*}}: DISPFlagLocalToUnit | DISPFlagDefinition
> // CHECK-NOKEXT: !DISubprogram(name: "__cxx_global_var_init.1",{{.*}} line: 16,{{.*}} DISPFlagLocalToUnit | DISPFlagDefinition
> // CHECK-NOKEXT: !DISubprogram(name: "__cxx_global_array_dtor",{{.*}} line: 16,{{.*}} DISPFlagLocalToUnit | DISPFlagDefinition
> -// CHECK-NOKEXT: !DISubprogram(name: "__dtor_array",{{.*}} line: 16,{{.*}} DISPFlagLocalToUnit | DISPFlagDefinition
> -// CHECK-NOKEXT: !DISubprogram(name: "__dtor__ZZ3foovE4stat",{{.*}} line: 19,{{.*}} DISPFlagLocalToUnit | DISPFlagDefinition
> +// CHECK-NOKEXT: !DISubprogram(name: "__dtor_array",{{.*}}: DISPFlagLocalToUnit | DISPFlagDefinition
> +// CHECK-NOKEXT: !DISubprogram(name: "__dtor__ZZ3foovE4stat",{{.*}} DISPFlagLocalToUnit | DISPFlagDefinition
> // CHECK-NOKEXT: !DISubprogram({{.*}} DISPFlagLocalToUnit | DISPFlagDefinition
>
> // CHECK-KEXT: !DISubprogram({{.*}} DISPFlagLocalToUnit | DISPFlagDefinition
>
> // CHECK-MSVC: !DISubprogram(name: "`dynamic initializer for 'glob'",{{.*}} line: 15,{{.*}}: DISPFlagLocalToUnit | DISPFlagDefinition
> -// CHECK-MSVC: !DISubprogram(name: "`dynamic atexit destructor for 'glob'",{{.*}} line: 15,{{.*}}: DISPFlagLocalToUnit | DISPFlagDefinition
> +// CHECK-MSVC: !DISubprogram(name: "`dynamic atexit destructor for 'glob'",{{.*}}: DISPFlagLocalToUnit | DISPFlagDefinition
> // CHECK-MSVC: !DISubprogram(name: "`dynamic initializer for 'array'",{{.*}} line: 16,{{.*}}: DISPFlagLocalToUnit | DISPFlagDefinition
> // CHECK-MSVC: !DISubprogram(name: "__cxx_global_array_dtor",{{.*}} line: 16,{{.*}}: DISPFlagLocalToUnit | DISPFlagDefinition
> -// CHECK-MSVC: !DISubprogram(name: "`dynamic atexit destructor for 'array'",{{.*}} line: 16,{{.*}}: DISPFlagLocalToUnit | DISPFlagDefinition
> -// CHECK-MSVC: !DISubprogram(name: "`dynamic atexit destructor for 'stat'",{{.*}} line: 19,{{.*}}: DISPFlagLocalToUnit | DISPFlagDefinition
> +// CHECK-MSVC: !DISubprogram(name: "`dynamic atexit destructor for 'array'",{{.*}}: DISPFlagLocalToUnit | DISPFlagDefinition
> +// CHECK-MSVC: !DISubprogram(name: "`dynamic atexit destructor for 'stat'",{{.*}}: DISPFlagLocalToUnit | DISPFlagDefinition
>
> // MSVC does weird stuff when templates are involved, so we don't match exactly,
> // but these names are reasonable.
> // FIXME: These should not be marked DISPFlagLocalToUnit.
> // CHECK-MSVC: !DISubprogram(name: "FooTpl<int>::`dynamic initializer for 'sdm_tpl<int>'",{{.*}} line: 29,{{.*}}: DISPFlagLocalToUnit | DISPFlagDefinition
> -// CHECK-MSVC: !DISubprogram(name: "FooTpl<int>::`dynamic atexit destructor for 'sdm_tpl<int>'",{{.*}} line: 29,{{.*}}: DISPFlagLocalToUnit | DISPFlagDefinition
> +// CHECK-MSVC: !DISubprogram(name: "FooTpl<int>::`dynamic atexit destructor for 'sdm_tpl<int>'",{{.*}}: DISPFlagLocalToUnit | DISPFlagDefinition
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list