Skip to content

Commit 94e7582

Browse files
committed
[IRGen] This ArtificialLoc requires a debug scope.
An `IRGenFunction` may not have a debug scope--for example, a dispatch thunk--but creating an `AritificalLocation` requires one. Only create an `ArtificalLocation` here if the `IRGenFunction` has one. Unfortunately, I don't have an isolated test case. Fixes a compiler crash.
1 parent 94b40d1 commit 94e7582

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/IRGen/GenCall.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5023,8 +5023,11 @@ static void emitRetconCoroutineEntry(
50235023
for (auto *arg : finalArguments) {
50245024
arguments.push_back(arg);
50255025
}
5026-
ArtificialLocation Loc(IGF.getDebugScope(), IGF.IGM.DebugInfo.get(),
5027-
IGF.Builder);
5026+
std::optional<ArtificialLocation> Loc;
5027+
if (IGF.getDebugScope()) {
5028+
Loc.emplace(IGF.getDebugScope(), IGF.IGM.DebugInfo.get(),
5029+
IGF.Builder);
5030+
}
50285031
llvm::Value *id = IGF.Builder.CreateIntrinsicCall(idIntrinsic, arguments);
50295032

50305033
// Call 'llvm.coro.begin', just for consistency with the normal pattern.

0 commit comments

Comments
 (0)