mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Fix SILGenFunction::emitBasicProlog for @lifetime with default args.
LifetimeDependencies were being read from the wrong DeclContext. Fixes rdar://142451893 (Crash during AST -> SIL lowering)
This commit is contained in:
@@ -1643,9 +1643,12 @@ uint16_t SILGenFunction::emitBasicProlog(
|
||||
emitIndirectErrorParameter(*this, *errorType, *origErrorType, DC);
|
||||
}
|
||||
|
||||
// Parameters with scoped dependencies may lower differently.
|
||||
// Parameters with scoped dependencies may lower differently. Parameters are
|
||||
// relative to the current SILGenFunction, not the passed in DeclContext. For
|
||||
// example, the an argument initializer's DeclContext is the enclosing
|
||||
// function definition rather that the initializer's generator function.
|
||||
llvm::SmallPtrSet<ParamDecl *, 2> scopedDependencyParams;
|
||||
if (auto afd = dyn_cast<AbstractFunctionDecl>(DC)) {
|
||||
if (auto afd = dyn_cast<AbstractFunctionDecl>(FunctionDC)) {
|
||||
if (auto deps = afd->getLifetimeDependencies()) {
|
||||
for (auto &dep : *deps) {
|
||||
auto scoped = dep.getScopeIndices();
|
||||
|
||||
Reference in New Issue
Block a user