Skip to content

Commit 3b358c5

Browse files
authored
Merge pull request #77016 from meg-gupta/cachelifetimedep
Cache absence of lifetime dependencies during deserialization
2 parents 2fb72bb + f3a6d44 commit 3b358c5

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

lib/Serialization/Deserialization.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3749,10 +3749,9 @@ class DeclDeserializer {
37493749
lifetimeDependencies.push_back(*info);
37503750
}
37513751

3752-
if (!lifetimeDependencies.empty()) {
3753-
ctx.evaluator.cacheOutput(LifetimeDependenceInfoRequest{ctor},
3754-
ctx.AllocateCopy(lifetimeDependencies));
3755-
}
3752+
ctx.evaluator.cacheOutput(LifetimeDependenceInfoRequest{ctor},
3753+
lifetimeDependencies.empty()? std::nullopt :
3754+
ctx.AllocateCopy(lifetimeDependencies));
37563755

37573756
if (auto errorConvention = MF.maybeReadForeignErrorConvention())
37583757
ctor->setForeignErrorConvention(*errorConvention);
@@ -4338,10 +4337,9 @@ class DeclDeserializer {
43384337
lifetimeDependencies.push_back(*info);
43394338
}
43404339

4341-
if (!lifetimeDependencies.empty()) {
4342-
ctx.evaluator.cacheOutput(LifetimeDependenceInfoRequest{fn},
4343-
ctx.AllocateCopy(lifetimeDependencies));
4344-
}
4340+
ctx.evaluator.cacheOutput(LifetimeDependenceInfoRequest{fn},
4341+
lifetimeDependencies.empty() ? std::nullopt
4342+
: ctx.AllocateCopy(lifetimeDependencies));
43454343

43464344
if (auto errorConvention = MF.maybeReadForeignErrorConvention())
43474345
fn->setForeignErrorConvention(*errorConvention);

0 commit comments

Comments
 (0)