Skip to content

Commit 57e316a

Browse files
Merge pull request #7691 from adrian-prantl/117323398
Add error logging when xcrun fails to find an SDK
2 parents d7f3616 + af09841 commit 57e316a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1713,7 +1713,16 @@ static std::string GetSDKPath(std::string m_description, XcodeSDK sdk) {
17131713
}
17141714

17151715
std::string sdk_path = sdk_path_or_err->str();
1716-
LOG_PRINTF(GetLog(LLDBLog::Types), "Host SDK path: `%s` (XcodeSDK: %s)",
1716+
// GetSDKRoot reports no SDK as an empty string.
1717+
if (sdk_path.empty()) {
1718+
std::string sdk_spec = sdk.GetString().str();
1719+
Debugger::ReportError("LLDB couldn't find an SDK for \"" + sdk_spec + "\".");
1720+
HEALTH_LOG_PRINTF("Could not find an SDK for \"%s\". Try to verify that "
1721+
"\"xcrun --show-sdk-path --sdk %s\" works.",
1722+
sdk_spec.c_str(), sdk_spec.c_str());
1723+
return {};
1724+
}
1725+
LOG_PRINTF(GetLog(LLDBLog::Types), "Host SDK path: \"%s\" (XcodeSDK: %s)",
17171726
sdk_path.c_str(), sdk.GetString().str().c_str());
17181727
return sdk_path;
17191728
}

0 commit comments

Comments
 (0)