mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Merge pull request #32147 from hamishknight/modulo-module
This commit is contained in:
@@ -489,6 +489,12 @@ Optional<unsigned> CompilerInstance::setUpCodeCompletionBuffer() {
|
||||
return codeCompletionBufferID;
|
||||
}
|
||||
|
||||
SourceFile *CompilerInstance::getCodeCompletionFile() const {
|
||||
auto *mod = getMainModule();
|
||||
auto &eval = mod->getASTContext().evaluator;
|
||||
return evaluateOrDefault(eval, CodeCompletionFileRequest{mod}, nullptr);
|
||||
}
|
||||
|
||||
static bool shouldTreatSingleInputAsMain(InputFileKind inputKind) {
|
||||
switch (inputKind) {
|
||||
case InputFileKind::Swift:
|
||||
@@ -707,6 +713,12 @@ ModuleDecl *CompilerInstance::getMainModule() const {
|
||||
return MainModule;
|
||||
}
|
||||
|
||||
void CompilerInstance::setMainModule(ModuleDecl *newMod) {
|
||||
assert(newMod->isMainModule());
|
||||
MainModule = newMod;
|
||||
Context->LoadedModules[newMod->getName()] = newMod;
|
||||
}
|
||||
|
||||
void CompilerInstance::performParseOnly(bool EvaluateConditionals,
|
||||
bool CanDelayBodies) {
|
||||
const InputFileKind Kind = Invocation.getInputKind();
|
||||
@@ -899,12 +911,6 @@ SourceFile *CompilerInstance::createSourceFileForMainModule(
|
||||
if (isPrimary) {
|
||||
inputFile->enableInterfaceHash();
|
||||
}
|
||||
|
||||
if (bufferID == SourceMgr.getCodeCompletionBufferID()) {
|
||||
assert(!CodeCompletionFile && "Multiple code completion files?");
|
||||
CodeCompletionFile = inputFile;
|
||||
}
|
||||
|
||||
return inputFile;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user