Skip to content

Commit 905b6b1

Browse files
committed
[Serialization] Ignore parsed declarations when resolving x-refs.
A cross-reference in a module cannot refer to a parsed entity, because the parsed entity couldn’t have been seen when the module was built. Filter these out, which prevents a crash in the subsequent commit.
1 parent 5d185d1 commit 905b6b1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/Serialization/Deserialization.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,6 +1128,11 @@ static void filterValues(Type expectedTy, ModuleDecl *expectedModule,
11281128

11291129
auto newEnd = std::remove_if(values.begin(), values.end(),
11301130
[=](ValueDecl *value) {
1131+
// Ignore anything that was parsed (vs. deserialized), because a serialized
1132+
// module cannot refer to it.
1133+
if (value->getDeclContext()->getParentSourceFile())
1134+
return true;
1135+
11311136
if (isType != isa<TypeDecl>(value))
11321137
return true;
11331138
if (!value->hasInterfaceType())

0 commit comments

Comments
 (0)