Skip to content

Commit ab87766

Browse files
authored
Merge pull request #3732 from apple/lldb-Log-modules-using-internal-and-public-SDKs-20210726
[lldb] Log modules using internal and public SDKs
2 parents de273e3 + 92d0635 commit ab87766

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.cpp

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1771,12 +1771,24 @@ SwiftASTContext::CreateInstance(lldb::LanguageType language, Module &module,
17711771

17721772
// Force parsing of the CUs to extract the SDK info.
17731773
XcodeSDK sdk;
1774+
bool found_public_sdk = false;
1775+
bool found_internal_sdk = false;
17741776
if (SymbolFile *sym_file = module.GetSymbolFile())
1775-
for (unsigned i = 0; i < sym_file->GetNumCompileUnits(); ++i) {
1777+
for (unsigned i = 0; i < sym_file->GetNumCompileUnits(); ++i)
17761778
if (auto cu_sp = sym_file->GetCompileUnitAtIndex(i))
1777-
if (cu_sp->GetLanguage() == lldb::eLanguageTypeSwift)
1778-
sdk.Merge(sym_file->ParseXcodeSDK(*cu_sp));
1779-
}
1779+
if (cu_sp->GetLanguage() == lldb::eLanguageTypeSwift) {
1780+
auto cu_sdk = sym_file->ParseXcodeSDK(*cu_sp);
1781+
sdk.Merge(cu_sdk);
1782+
bool is_internal_sdk = cu_sdk.IsAppleInternalSDK();
1783+
found_public_sdk |= !is_internal_sdk;
1784+
found_internal_sdk |= is_internal_sdk;
1785+
}
1786+
1787+
if (found_public_sdk && found_internal_sdk)
1788+
HEALTH_LOG_PRINTF("Unsupported mixing of public and internal SDKs in "
1789+
"'%s'. Mixed use of SDKs indicates use of different "
1790+
"toolchains, which is not supported.",
1791+
module.GetFileSpec().GetFilename().GetCString());
17801792

17811793
std::string sdk_path = HostInfo::GetXcodeSDKPath(sdk).str();
17821794
LOG_PRINTF(LIBLLDB_LOG_TYPES, "Host SDK path for sdk %s is %s.",

0 commit comments

Comments
 (0)