[NFC] Refactor getRenameDecl to use the request evaluator

Move `getRenameDecl` from `PrintAsObjC` into its own request so that
other components can re-use this functionality.
This commit is contained in:
Ben Barham
2021-07-17 09:04:58 +10:00
parent 35aa862e1d
commit f1c45de2a9
14 changed files with 185 additions and 139 deletions

View File

@@ -2118,30 +2118,3 @@ CompilerInvocation::setUpInputForSILTool(
}
return fileBufOrErr;
}
bool CompilerInvocation::isModuleExternallyConsumed(
const ModuleDecl *mod) const {
// Modules for executables aren't expected to be consumed by other modules.
// This picks up all kinds of entrypoints, including script mode,
// @UIApplicationMain and @NSApplicationMain.
if (mod->hasEntryPoint()) {
return false;
}
// If an implicit Objective-C header was needed to construct this module, it
// must be the product of a library target.
if (!getFrontendOptions().ImplicitObjCHeaderPath.empty()) {
return false;
}
// App extensions are special beasts because they build without entrypoints
// like library targets, but they behave like executable targets because
// their associated modules are not suitable for distribution.
if (mod->getASTContext().LangOpts.EnableAppExtensionRestrictions) {
return false;
}
// FIXME: This is still a lousy approximation of whether the module file will
// be externally consumed.
return true;
}