For developing the OS itself there exists an "internal" variant of each SDK. This patch adds support for these SDK directories to the XcodeSDK class.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
lldb/include/lldb/Utility/XcodeSDK.h | ||
---|---|---|
54–66 | I think a struct would be less opaque. |
lldb/include/lldb/Utility/XcodeSDK.h | ||
---|---|---|
54–66 | Agreed. The tuple was meant to facilitate having the internal bit downstream, but we decided that there's no reason not have it upstream. I'll change it! |
lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm | ||
---|---|---|
354–358 | I don't think we need this last fallback. The internal and public SDKs are very different. You should be able to use an internal one to replace a public one, but not the other way around. | |
lldb/source/Utility/XcodeSDK.cpp | ||
153–159 | Why not leave this function as is and try to add both "internal" and ".internal" to the SDK name in GetXcodeSDK() without special-casing macOS? I'm not sure that macOS is actually special. |
lldb/include/lldb/Utility/XcodeSDK.h | ||
---|---|---|
74 | Can this now take an SDKInfo? |
One more comment but otherwise this LGTM
lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm | ||
---|---|---|
332 | I always find a while like this really suspicious, even though the logic looks correct. Can you achieve the same thing in a less clever way with a lambda and early return from that? |
lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm | ||
---|---|---|
332 | Not sure. Maybe I'm doing something other than what you were thinking about, but the lambda I came up with looks even more pretentious ;-) What complicates it is that I need to check the condition at the beginning and want to return out of the function from within the body. Do you have a specific suggestion in mind? |
lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm | ||
---|---|---|
332 | I'm probably missing something. What I had in mind was []() { // Try an alternate spelling of the name ("macosx10.9internal"). if (info.type == XcodeSDK::Type::MacOSX && !info.version.empty() && info.internal) { llvm::StringRef fixed(sdk_name); if (fixed.consume_back(".internal")) sdk_name = fixed.str()+"internal"; path = find_sdk(sdk_name); if (!path.empty()) return path; } Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); LLDB_LOGF(log, "Couldn't find SDK %s on host", sdk_name.c_str()); // Try without the version. if (!info.version.empty()) { info.version = {}; sdk_name = XcodeSDK::GetCanonicalName(info); path = find_sdk(sdk_name); if (!path.empty()) return path; } LLDB_LOGF(log, "Couldn't find any matching SDK on host"); return {}; } |
lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm | ||
---|---|---|
332 | But for it to work you'd need to wrap it inside if (path.empty()) path = [&]() { ... }(); if (path.empty()} return {}; And that is three lines longer than the original code, and the sequence [&]() { ... }(), which doesn't meet my threshold for being easier to read. This is all highly subjective of course, so let me know what you think. I'm not married to the loop either, and in the end it doesn't really matter :-) |
lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm | ||
---|---|---|
332 | You could move the first check into the lambda. But it seems like you thought this true so I trust your judgement, go with the while loop ;-) |
I think a struct would be less opaque.