Re-land [DebugInfo] Add debug location to stubs generated by CGDeclCXX and mark them...
authorAlexandre Ganea <alexandre.ganea@ubisoft.com>
Fri, 9 Oct 2020 00:48:50 +0000 (20:48 -0400)
committerAlexandre Ganea <alexandre.ganea@ubisoft.com>
Fri, 9 Oct 2020 00:49:17 +0000 (20:49 -0400)
commit66face6aa0f5f68de56067b0dff3295e47fdf66c
tree7d7181089b35e9789dd7bcafb93ee60cf1a9adab
parent1c19900f9417bd0b832c1cb70863b2439a18647f
Re-land [DebugInfo] Add debug location to stubs generated by CGDeclCXX and mark them as artificial

Previously, when clang was compiled with -DLLVM_ENABLE_ASSERTIONS=ON, the added tests were displaying:

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 debug-info-no-location.cpp> -gcodeview -debug-info-kind=limited
1.      <eof> parser at end of file
2.      Per-function optimization

Fixes PR43012

Differential Revision: https://reviews.llvm.org/D66328
clang/include/clang/AST/GlobalDecl.h
clang/lib/CodeGen/CGDebugInfo.cpp
clang/lib/CodeGen/CGDeclCXX.cpp
clang/test/CodeGenCXX/aix-static-init-debug-info.cpp
clang/test/CodeGenCXX/debug-info-atexit-stub.cpp [new file with mode: 0644]
clang/test/CodeGenCXX/debug-info-destroy-helper.cpp [new file with mode: 0644]
clang/test/CodeGenCXX/debug-info-global-ctor-dtor.cpp
clang/test/CodeGenCXX/debug-info-line.cpp