Skip to content

Commit 04726c0

Browse files
authored
Merge pull request #83181 from egorzhdan/egorzhdan/default-arg-lifetime-conformance
[cxx-interop] Prevent protocol conformance table from being prematurely populated
2 parents e76997a + f0a32d1 commit 04726c0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/ClangImporter/SwiftDeclSynthesizer.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "swift/AST/ParameterList.h"
2222
#include "swift/AST/Pattern.h"
2323
#include "swift/AST/Stmt.h"
24+
#include "swift/AST/TypeCheckRequests.h"
2425
#include "swift/Basic/Assertions.h"
2526
#include "clang/AST/Mangle.h"
2627
#include "clang/Sema/DelayedDiagnostic.h"
@@ -2532,6 +2533,11 @@ SwiftDeclSynthesizer::makeDefaultArgument(const clang::ParmVarDecl *param,
25322533
funcDecl->setAccess(AccessLevel::Public);
25332534
funcDecl->getAttrs().add(new (ctx)
25342535
AlwaysEmitIntoClientAttr(/*IsImplicit=*/true));
2536+
// At this point, the parameter/return types of funcDecl might not be imported
2537+
// into Swift completely, meaning that their protocol conformances might not
2538+
// be populated yet. Prevent LifetimeDependenceInfoRequest from prematurely
2539+
// populating the conformance table for the types involved.
2540+
ctx.evaluator.cacheOutput(LifetimeDependenceInfoRequest{funcDecl}, {});
25352541

25362542
ImporterImpl.defaultArgGenerators[param] = funcDecl;
25372543

0 commit comments

Comments
 (0)