mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Merge pull request #84225 from hamishknight/access-noted
Requestify the loading of access notes
This commit is contained in:
@@ -1564,28 +1564,6 @@ void CompilerInstance::setMainModule(ModuleDecl *newMod) {
|
||||
Context->MainModule = newMod;
|
||||
}
|
||||
|
||||
void CompilerInstance::loadAccessNotesIfNeeded() {
|
||||
if (Invocation.getFrontendOptions().AccessNotesPath.empty())
|
||||
return;
|
||||
|
||||
auto *mainModule = getMainModule();
|
||||
|
||||
auto accessNotesPath = Invocation.getFrontendOptions().AccessNotesPath;
|
||||
|
||||
auto bufferOrError =
|
||||
swift::vfs::getFileOrSTDIN(getFileSystem(), accessNotesPath);
|
||||
if (bufferOrError) {
|
||||
int sourceID = SourceMgr.addNewSourceBuffer(std::move(bufferOrError.get()));
|
||||
auto buffer = SourceMgr.getLLVMSourceMgr().getMemoryBuffer(sourceID);
|
||||
|
||||
if (auto accessNotesFile = AccessNotesFile::load(*Context, buffer))
|
||||
mainModule->getAccessNotes() = *accessNotesFile;
|
||||
} else {
|
||||
Diagnostics.diagnose(SourceLoc(), diag::access_notes_file_io_error,
|
||||
accessNotesPath, bufferOrError.getError().message());
|
||||
}
|
||||
}
|
||||
|
||||
bool CompilerInstance::performParseAndResolveImportsOnly() {
|
||||
FrontendStatsTracer tracer(getStatsReporter(), "parse-and-resolve-imports");
|
||||
|
||||
@@ -1593,9 +1571,6 @@ bool CompilerInstance::performParseAndResolveImportsOnly() {
|
||||
// lazily evaluate instead. Once the below computations are requestified we
|
||||
// ought to be able to remove this function.
|
||||
|
||||
// Load access notes.
|
||||
loadAccessNotesIfNeeded();
|
||||
|
||||
// Resolve imports for all the source files in the module.
|
||||
auto *mainModule = getMainModule();
|
||||
performImportResolution(mainModule);
|
||||
|
||||
Reference in New Issue
Block a user