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

@@ -257,6 +257,9 @@ private:
AccessNotesFile accessNotes;
/// Used by the debugger to bypass resilient access to fields.
bool BypassResilience = false;
ModuleDecl(Identifier name, ASTContext &ctx, ImplicitImportInfo importInfo);
public:
@@ -290,6 +293,12 @@ public:
AccessNotesFile &getAccessNotes() { return accessNotes; }
const AccessNotesFile &getAccessNotes() const { return accessNotes; }
/// Return whether the module was imported with resilience disabled. The
/// debugger does this to access private fields.
bool getBypassResilience() const { return BypassResilience; }
/// Only to be called by MemoryBufferSerializedModuleLoader.
void setBypassResilience() { BypassResilience = true; }
ArrayRef<FileUnit *> getFiles() {
assert(!Files.empty() || failedToLoad());
return Files;