IRGen: New way of bypassing resilience for LLDB

When running Swift from within LLDB, we need to bypass resilience since LLDB
does not support resilience yet. However, the bypass was done too early as
part of the module loader, which had the effect of disabling resilience
altogether.

We still want resilience at the SIL level so that function types lower the
same with debugger support turned on and off. Only IRGen needs to bypass
resilience, so that LLDB can calculate fragile layouts of types. Also, the
DebuggerSupport flag is not always set in the ASTContexts created by LLDB.

So replace it with a new flag that only controls this behavior and nothing
else, and make it part of IRGenOptions to make it totally clear that it only
impacts IRGen.

Together with the paired LLDB change, fixes <rdar://problem/38719739>
and <rdar://problem/38483762>.
This commit is contained in:
Slava Pestov
2018-04-17 15:54:49 -07:00
parent f1076fdf4c
commit 55633e8d06
8 changed files with 57 additions and 26 deletions

View File

@@ -200,10 +200,7 @@ FileUnit *SerializedModuleLoader::loadAST(
isFramework, loadedModuleFile,
&extendedInfo);
if (loadInfo.status == serialization::Status::Valid) {
// In LLDB always use the default resilience strategy, so IRGen can query
// the size of resilient types.
if (!Ctx.LangOpts.DebuggerSupport)
M.setResilienceStrategy(extendedInfo.getResilienceStrategy());
M.setResilienceStrategy(extendedInfo.getResilienceStrategy());
// We've loaded the file. Now try to bring it into the AST.
auto fileUnit = new (Ctx) SerializedASTFile(M, *loadedModuleFile,