mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[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:
@@ -1638,6 +1638,32 @@ Fingerprint ModuleDecl::getFingerprint() const {
|
||||
return Fingerprint{std::move(hasher)};
|
||||
}
|
||||
|
||||
bool ModuleDecl::isExternallyConsumed() 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 (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 (!getImplicitImportInfo().BridgingHeaderPath.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 (getASTContext().LangOpts.EnableAppExtensionRestrictions) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// FIXME: This is still a lousy approximation of whether the module file will
|
||||
// be externally consumed.
|
||||
return true;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Cross-Import Overlays
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
Reference in New Issue
Block a user