From 1858c664de64fc8829bf09571aa82f6f4cea49b9 Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Sun, 24 Apr 2016 22:22:29 +0000 Subject: Debug info: Apply an empty debug location for global OpenMP destructors. LLVM really wants a debug location on every inlinable call in a function with debug info, because it otherwise cannot set up inlining debug info. This change applies an artificial line 0 debug location (which is how DWARF marks automatically generated code that has no corresponding source code) to the .__kmpc_global_dtor_. functions to avoid the LLVM Verifier complaining. llvm-svn: 267369 --- clang/lib/CodeGen/CGOpenMPRuntime.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'clang/lib') diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp index 37ecc053afa..f732131bf5b 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp @@ -1685,8 +1685,11 @@ llvm::Function *CGOpenMPRuntime::emitThreadPrivateVarDefinition( auto FTy = CGM.getTypes().GetFunctionType(FI); auto Fn = CGM.CreateGlobalInitOrDestructFunction( FTy, ".__kmpc_global_dtor_.", FI, Loc); + auto NL = ApplyDebugLocation::CreateEmpty(DtorCGF); DtorCGF.StartFunction(GlobalDecl(), CGM.getContext().VoidTy, Fn, FI, Args, SourceLocation()); + // Create a scope with an artificial location for the body of this function. + auto AL = ApplyDebugLocation::CreateArtificial(DtorCGF); auto ArgVal = DtorCGF.EmitLoadOfScalar( DtorCGF.GetAddrOfLocalVar(&Dst), /*Volatile=*/false, CGM.getContext().VoidPtrTy, Dst.getLocation()); -- cgit v1.2.3