Merge pull request #62185 from xymus/improve-rmodule-loading

Improve `-Rmodule-loading` to show both the path to the source and to the cached file actually loaded
This commit is contained in:
Alexis Laferrière
2022-11-28 14:25:15 -08:00
committed by GitHub
18 changed files with 144 additions and 35 deletions

View File

@@ -1965,6 +1965,25 @@ StringRef ModuleDecl::getModuleFilename() const {
return Result;
}
StringRef ModuleDecl::getModuleSourceFilename() const {
for (auto F : getFiles()) {
if (auto *SFU = dyn_cast<SynthesizedFileUnit>(F))
continue;
return F->getModuleDefiningPath();
}
return StringRef();
}
StringRef ModuleDecl::getModuleLoadedFilename() const {
for (auto F : getFiles()) {
if (auto LF = dyn_cast<LoadedFile>(F)) {
return LF->getLoadedFilename();
}
}
return StringRef();
}
bool ModuleDecl::isStdlibModule() const {
return !getParent() && getName() == getASTContext().StdlibModuleName;
}