Move AST transforms out of the Frontend

Move the playground and debugger transforms out
of the Frontend and into `performTypeChecking`, as
we'd want them to be applied if
`performTypeChecking` was called lazily.
This commit is contained in:
Hamish Knight
2020-04-24 14:23:16 -07:00
parent a1716fe2a6
commit b78f47490a
7 changed files with 49 additions and 51 deletions

View File

@@ -520,19 +520,21 @@ bool SwiftASTManager::initCompilerInvocation(
ImporterOpts.DetailedPreprocessingRecord = true;
assert(!Invocation.getModuleName().empty());
Invocation.getLangOptions().AttachCommentsToDecls = true;
Invocation.getLangOptions().DiagnosticsEditorMode = true;
Invocation.getLangOptions().CollectParsedToken = true;
auto &FrontendOpts = Invocation.getFrontendOptions();
if (FrontendOpts.PlaygroundTransform) {
auto &LangOpts = Invocation.getLangOptions();
LangOpts.AttachCommentsToDecls = true;
LangOpts.DiagnosticsEditorMode = true;
LangOpts.CollectParsedToken = true;
if (LangOpts.PlaygroundTransform) {
// The playground instrumenter changes the AST in ways that disrupt the
// SourceKit functionality. Since we don't need the instrumenter, and all we
// actually need is the playground semantics visible to the user, like
// silencing the "expression resolves to an unused l-value" error, disable it.
FrontendOpts.PlaygroundTransform = false;
LangOpts.PlaygroundTransform = false;
}
// Disable the index-store functionality for the sourcekitd requests.
auto &FrontendOpts = Invocation.getFrontendOptions();
FrontendOpts.IndexStorePath.clear();
ImporterOpts.IndexStorePath.clear();