Skip to content

Commit 7327554

Browse files
committed
Sometimes the debug scope already attached to a SILFunction before
deserialization contains AST information which is needed in certain cases. Do not overwrite the debug scope in that case
1 parent e522333 commit 7327554

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

lib/Serialization/DeserializeSIL.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1131,7 +1131,8 @@ llvm::Expected<SILFunction *> SILDeserializer::readSILFunctionChecked(
11311131

11321132
auto Scope = maybeScope.get();
11331133
if (isFirstScope) {
1134-
fn->setDebugScope(Scope);
1134+
if (!fn->getDebugScope() || fn->getDebugScope()->getLoc().isAutoGenerated())
1135+
fn->setDebugScope(Scope);
11351136
isFirstScope = false;
11361137
}
11371138
Builder.setCurrentDebugScope(Scope);

test/Serialization/debug-value.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,4 @@ func test() {
5050
// CHECK: debug_value {{.*}} : $Builtin.Int64, var, (name "temp", loc "{{.*}}MyModule.swift":3:9, scope {{.*}}), type $Int64, expr op_fragment:#Int64._value, loc "{{.*}}MyModule.swift":5:14, scope
5151

5252
test()
53+
// CHECK-NOT: UnknownCode

0 commit comments

Comments
 (0)