Expose an ImportNonPublicDependencies LangOpt for LLDB (NFC).

This patch allows controlling the automatic import of private dependencies
separately from the DebuggerSupport option, which currently also triggers this
behavior. With explicit modules + precise compiler invocations LLDB is moving
towards no longer needing this behavior.

rdar://133088201
(cherry picked from commit a1ba7159e3)
This commit is contained in:
Adrian Prantl
2024-08-02 14:13:01 -07:00
parent eea22c2f09
commit f0902a9163
5 changed files with 17 additions and 18 deletions

View File

@@ -1801,7 +1801,7 @@ std::string ModuleFileSharedCore::resolveModuleDefiningFilePath(const StringRef
ModuleLoadingBehavior
ModuleFileSharedCore::getTransitiveLoadingBehavior(
const Dependency &dependency,
bool debuggerMode,
bool importNonPublicDependencies,
bool isPartialModule,
StringRef packageName,
bool forTestable) const {
@@ -1817,7 +1817,7 @@ ModuleFileSharedCore::getTransitiveLoadingBehavior(
if (dependency.isImplementationOnly()) {
// Implementation-only dependencies are not usually loaded from
// transitive imports.
if (debuggerMode || forTestable) {
if (importNonPublicDependencies || forTestable) {
// In the debugger, try to load the module if possible.
// Same in the case of a testable import, try to load the dependency
// but don't fail if it's missing as this could be source breaking.
@@ -1835,7 +1835,7 @@ ModuleFileSharedCore::getTransitiveLoadingBehavior(
// on testable imports.
if (forTestable || !moduleIsResilient) {
return ModuleLoadingBehavior::Required;
} else if (debuggerMode) {
} else if (importNonPublicDependencies) {
return ModuleLoadingBehavior::Optional;
} else {
return ModuleLoadingBehavior::Ignored;
@@ -1849,7 +1849,7 @@ ModuleFileSharedCore::getTransitiveLoadingBehavior(
forTestable ||
!moduleIsResilient) {
return ModuleLoadingBehavior::Required;
} else if (debuggerMode) {
} else if (importNonPublicDependencies) {
return ModuleLoadingBehavior::Optional;
} else {
return ModuleLoadingBehavior::Ignored;