If we tried getting the SDK from xcrun with the developer dir set and it failed, try without the developer dir.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
So this is adding a fallback that ignores DEVELOPER_DIR if it is set, but doesn't exist? Is that really desirable, or am I misunderstanding the patch? I would expect LLDB to fail hard if the DEVELOPER_DIR in the environment is wrong and not silently ignore it...
lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm | ||
---|---|---|
395 | Can we delete this comment? I find it more confusing than helpful... |
It's slightly more subtle than that, it falls back to running xcrun without a developer dir if we couldn't find the desired SDK with the developer dir set. It doesn't mean the developer dir is invalid or doesn't exist, it just means we couldn't find the SDK there. Imagine for the sake of argument that you're running an Xcode that has no SDKs and that this Xcode is not xcode-selected. Based on lldb's location in LLDB.framework it will do an xcrun with the developer set to the Xcode without any SDKs and that will fail. With this patch, when that happens, we'll fall back to trying the xcode-selected by running xcrun without a developer dir specified. I know it sounds like a contrived example but that's exactly what I was running into...
lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm | ||
---|---|---|
424 | Can you use a fresh std::string with a different name here? |
In theory we could make this a StringRef and then have one less copy. Not important though.