Skip to content

Commit 022a8b1

Browse files
committed
Fix a bug that prevented setting a DebugLoc if the first SILInstruction
in the function is setup code for a closure and re-enable the assertions that caught this on the bots. rdar://problem/26955467
1 parent ad00a74 commit 022a8b1

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

lib/IRGen/IRBuilder.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ class IRBuilder : public IRBuilderBase {
262262
llvm::CallInst *CreateCall(llvm::Value *Callee, ArrayRef<llvm::Value *> Args,
263263
const Twine &Name = "",
264264
llvm::MDNode *FPMathTag = nullptr) {
265+
assert((!DebugInfo || getCurrentDebugLocation()) && "no debugloc on call");
265266
auto Call = IRBuilderBase::CreateCall(Callee, Args, Name, FPMathTag);
266267
setCallingConvUsingCallee(Call);
267268
return Call;
@@ -271,6 +272,7 @@ class IRBuilder : public IRBuilderBase {
271272
ArrayRef<llvm::Value *> Args,
272273
const Twine &Name = "",
273274
llvm::MDNode *FPMathTag = nullptr) {
275+
assert((!DebugInfo || getCurrentDebugLocation()) && "no debugloc on call");
274276
auto Call = IRBuilderBase::CreateCall(FTy, Callee, Args, Name, FPMathTag);
275277
setCallingConvUsingCallee(Call);
276278
return Call;
@@ -280,6 +282,7 @@ class IRBuilder : public IRBuilderBase {
280282
ArrayRef<llvm::Value *> Args,
281283
const Twine &Name = "",
282284
llvm::MDNode *FPMathTag = nullptr) {
285+
assert((!DebugInfo || getCurrentDebugLocation()) && "no debugloc on call");
283286
auto Call = IRBuilderBase::CreateCall(Callee, Args, Name, FPMathTag);
284287
setCallingConvUsingCallee(Call);
285288
return Call;

lib/IRGen/IRGenDebugInfo.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,9 @@ void IRGenDebugInfo::setCurrentLoc(IRBuilder &Builder, const SILDebugScope *DS,
313313
//
314314
// The actual closure has a closure expression as scope.
315315
if (Loc && isAbstractClosure(*Loc) && DS && !isAbstractClosure(DS->Loc)
316-
&& !Loc->is<ImplicitReturnLocation>())
317-
return;
316+
&& !Loc->is<ImplicitReturnLocation>()) {
317+
L.Line = L.Column = 0;
318+
}
318319

319320
if (L.Line == 0 && DS == LastScope) {
320321
// Reuse the last source location if we are still in the same

0 commit comments

Comments
 (0)