[CodeGen] Assign locations to calls to special struct helpers
Assign artificial locations to calls to special struct-related helper
functions.
Such calls may not inherit a location if emitted within FinishFunction,
at which point the lexical scope stack may be empty, causing CGDebugInfo
to report the current DebugLoc as empty.
Fixes an IR verifier complaint about a call to '__destructor_8_s0' not
having a !dbg location attached.
rdar://57293361
diff --git a/clang/lib/CodeGen/CGNonTrivialStruct.cpp b/clang/lib/CodeGen/CGNonTrivialStruct.cpp
index 05615aa..332e51e 100644
--- a/clang/lib/CodeGen/CGNonTrivialStruct.cpp
+++ b/clang/lib/CodeGen/CGNonTrivialStruct.cpp
@@ -817,6 +817,7 @@
static void callSpecialFunction(G &&Gen, StringRef FuncName, QualType QT,
bool IsVolatile, CodeGenFunction &CGF,
std::array<Address, N> Addrs) {
+ auto SetArtificialLoc = ApplyDebugLocation::CreateArtificial(CGF);
for (unsigned I = 0; I < N; ++I)
Addrs[I] = CGF.Builder.CreateBitCast(Addrs[I], CGF.CGM.Int8PtrPtrTy);
QT = IsVolatile ? QT.withVolatile() : QT;