diff options
author | Alexandre Ganea <alexandre.ganea@ubisoft.com> | 2019-08-20 22:09:49 +0000 |
---|---|---|
committer | Alexandre Ganea <alexandre.ganea@ubisoft.com> | 2019-08-20 22:09:49 +0000 |
commit | be6c0794197558c7ca9775cd7c0b97e816c2c5e2 (patch) | |
tree | beb651efe88c16fae3c7d96aebbc1d16cf812258 /clang/lib | |
parent | 22fb734907e004b057a4f97da5a3f8b90bf350cf (diff) | |
download | bcm5719-llvm-be6c0794197558c7ca9775cd7c0b97e816c2c5e2.tar.gz bcm5719-llvm-be6c0794197558c7ca9775cd7c0b97e816c2c5e2.zip |
[DebugInfo] Add debug location to dynamic atexit destructor
Fixes PR43012
Differential Revision: https://reviews.llvm.org/D66328
llvm-svn: 369458
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 3 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGDeclCXX.cpp | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 422fbc1e290..49337936eba 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -3564,7 +3564,8 @@ void CGDebugInfo::EmitFunctionStart(GlobalDecl GD, SourceLocation Loc, 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(); diff --git a/clang/lib/CodeGen/CGDeclCXX.cpp b/clang/lib/CodeGen/CGDeclCXX.cpp index 7a0605b8450..f7b1e389721 100644 --- a/clang/lib/CodeGen/CGDeclCXX.cpp +++ b/clang/lib/CodeGen/CGDeclCXX.cpp @@ -247,6 +247,8 @@ llvm::Function *CodeGenFunction::createAtExitStub(const VarDecl &VD, 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); |