diff --git a/lib/ClangImporter/SwiftDeclSynthesizer.cpp b/lib/ClangImporter/SwiftDeclSynthesizer.cpp index 617aee360edf4..d1c8535d7e9a3 100644 --- a/lib/ClangImporter/SwiftDeclSynthesizer.cpp +++ b/lib/ClangImporter/SwiftDeclSynthesizer.cpp @@ -21,6 +21,7 @@ #include "swift/AST/ParameterList.h" #include "swift/AST/Pattern.h" #include "swift/AST/Stmt.h" +#include "swift/AST/TypeCheckRequests.h" #include "swift/Basic/Assertions.h" #include "clang/AST/Mangle.h" #include "clang/Sema/DelayedDiagnostic.h" @@ -2532,6 +2533,11 @@ SwiftDeclSynthesizer::makeDefaultArgument(const clang::ParmVarDecl *param, funcDecl->setAccess(AccessLevel::Public); funcDecl->getAttrs().add(new (ctx) AlwaysEmitIntoClientAttr(/*IsImplicit=*/true)); + // At this point, the parameter/return types of funcDecl might not be imported + // into Swift completely, meaning that their protocol conformances might not + // be populated yet. Prevent LifetimeDependenceInfoRequest from prematurely + // populating the conformance table for the types involved. + ctx.evaluator.cacheOutput(LifetimeDependenceInfoRequest{funcDecl}, {}); ImporterImpl.defaultArgGenerators[param] = funcDecl;