Disable resilience for modules imported by the MemoryBuffer loader.

The MemoryBuffer loader is used by LLDB during debugging to import binary Swift
modules from .swift_ast sections. Modules imported from .swift_ast sections are
never produced from textual interfaces. By disabling resilience the expression
evaluator in the debugger can directly access private members.

rdar://79462915
This commit is contained in:
Adrian Prantl
2021-08-24 15:52:10 -07:00
parent 86a715d70e
commit e754f5a6c4
6 changed files with 48 additions and 19 deletions

View File

@@ -1879,7 +1879,7 @@ static bool isDirectToStorageAccess(const DeclContext *UseDC,
// If the storage is resilient, we cannot access it directly at all.
if (var->isResilient(UseDC->getParentModule(),
UseDC->getResilienceExpansion()))
return false;
return var->getModuleContext()->getBypassResilience();
if (isa<ConstructorDecl>(AFD) || isa<DestructorDecl>(AFD)) {
// The access must also be a member access on 'self' in all language modes.