[PATCH] D136315: [clang][Darwin] Try to guess the SDK root with xcrun when unspecified

2023-03-19 Thread Caleb Zulawski via Phabricator via cfe-commits
calebzulawski updated this revision to Diff 506434. calebzulawski added a comment. Corrected docs and updated upstream Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D136315/new/ https://reviews.llvm.org/D136315 Files: clang/docs/UsersManual.rst

[PATCH] D136315: [clang][Darwin] Try to guess the SDK root with xcrun when unspecified

2023-01-20 Thread Caleb Zulawski via Phabricator via cfe-commits
calebzulawski added a comment. In D136315#4070121 , @steven_wu wrote: > I definitely feel like if to fix your problem, a reverse option like > `-infer-sdkroot-from-xcrun` might be better/safer but it doesn't help the > general case where people doesn't

[PATCH] D136315: [clang][Darwin] Try to guess the SDK root with xcrun when unspecified

2023-01-20 Thread Caleb Zulawski via Phabricator via cfe-commits
calebzulawski updated this revision to Diff 490999. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D136315/new/ https://reviews.llvm.org/D136315 Files: clang/include/clang/Driver/Options.td clang/lib/Driver/ToolChains/Darwin.cpp clang/test/Drive

[PATCH] D136315: [clang][Darwin] Try to guess the SDK root with xcrun when unspecified

2023-01-20 Thread Caleb Zulawski via Phabricator via cfe-commits
calebzulawski added inline comments. Comment at: clang/test/Driver/darwin-sdk-detect.c:1 +// REQUIRES: system-darwin + steven_wu wrote: > This test won't work in all conditions. Like I said, you requires to have a > Xcode/CommandLineTools installation to make `x

[PATCH] D136315: [clang][Darwin] Try to guess the SDK root with xcrun when unspecified

2023-01-20 Thread Caleb Zulawski via Phabricator via cfe-commits
calebzulawski added a comment. In my situation, at least, I am the vendor of the toolchain and my configuration file contains `--sysroot=/../path/to/sysroot` with a known relative path to where the sysroot is distributed. Apple is unique in this situation, since I am not distributing the sysro

[PATCH] D136315: [clang][Darwin] Try to guess the SDK root with xcrun when unspecified

2023-01-20 Thread Caleb Zulawski via Phabricator via cfe-commits
calebzulawski added a comment. If `SDKROOT` is set or `-isysroot` is passed, `xcrun` won't be called so there is no regression for existing use cases like CMake. Additionally, if `xcrun` isn't found, no error is emitted. I also added the `--no-detect-xcode` flag based on similar feedback that

[PATCH] D136315: [clang][Darwin] Try to guess the SDK root with xcrun when unspecified

2023-01-20 Thread Caleb Zulawski via Phabricator via cfe-commits
calebzulawski added a comment. That makes more sense, I thought perhaps it was using `DEFAULT_SYSROOT`. The shim isn't smart enough to choose the sysroot from the target unfortunately. It looks like the only error is unrelated to this change, something with concepts in libc++. Repository:

[PATCH] D136315: [clang][Darwin] Try to guess the SDK root with xcrun when unspecified

2023-01-19 Thread Caleb Zulawski via Phabricator via cfe-commits
calebzulawski updated this revision to Diff 490698. calebzulawski added a comment. This revision is basically the same as before, but with two changes: - `darwin` targets (e.g. `x86_64-apple-darwin`) do not automatically detect the SDK. There is another bug where these targets don't seem to prop

[PATCH] D136315: [clang][Darwin] Try to guess the SDK root with xcrun when unspecified

2023-01-19 Thread Caleb Zulawski via Phabricator via cfe-commits
calebzulawski reopened this revision. calebzulawski added a comment. This revision is now accepted and ready to land. @thakis thanks. I have an updated revision that can be reviewed properly. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D136315/new/

[PATCH] D136315: [clang][Darwin] Try to guess the SDK root with xcrun when unspecified

2023-01-19 Thread Caleb Zulawski via Phabricator via cfe-commits
calebzulawski added a comment. @jryans thanks. I've confirmed that this is specifically a bug with `darwin` targets (not `macos`) not respecting platform versions when an SDK is present, I can even reproduce this with clang provided with Xcode. The following patch, for example, completely reso

[PATCH] D136315: [clang][Darwin] Try to guess the SDK root with xcrun when unspecified

2023-01-19 Thread Caleb Zulawski via Phabricator via cfe-commits
calebzulawski added a comment. One thing to throw into the mix: Apple's clang has a default sysroot configured, so with the default system compiler, there is no way to replicate this "build without a sysroot" scenario as far as I can tell. For the system compiler, I believe this behavior is a

[PATCH] D136315: [clang][Darwin] Try to guess the SDK root with xcrun when unspecified

2023-01-19 Thread Caleb Zulawski via Phabricator via cfe-commits
calebzulawski added a comment. In D136315#4065481 , @thakis wrote: > In D136315#4065426 , @calebzulawski > wrote: > >> I don't think we necessarily need to revert due to the xcrun quirk since I >> think it's har

[PATCH] D136315: [clang][Darwin] Try to guess the SDK root with xcrun when unspecified

2023-01-19 Thread Caleb Zulawski via Phabricator via cfe-commits
calebzulawski added a comment. I don't think we necessarily need to revert due to the xcrun quirk since I think it's harmless, though I can provide a follow up change if necessary. I just checked Rust's source as a comparison and it appears that for macOS targets it will always attempt to invo

[PATCH] D136315: [clang][Darwin] Try to guess the SDK root with xcrun when unspecified

2023-01-18 Thread Caleb Zulawski via Phabricator via cfe-commits
calebzulawski added a comment. Are those failures on Linux? I only developed this change on macOS, but the automated tests passed... Admittedly I'm not sure what should happen when building for macOS from Linux (is there any use case where that works and does anything useful? I'm not sure). I

[PATCH] D136315: [clang][Darwin] Try to guess the SDK root with xcrun when unspecified

2023-01-18 Thread Caleb Zulawski via Phabricator via cfe-commits
calebzulawski added a comment. @jryans I do not, I would appreciate that. Thanks! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D136315/new/ https://reviews.llvm.org/D136315 ___ cfe-commits mailing list c

[PATCH] D136315: [clang][Darwin] Try to guess the SDK root with xcrun when unspecified

2023-01-17 Thread Caleb Zulawski via Phabricator via cfe-commits
calebzulawski added a comment. Happy new year all-- Is there anything left for me to do before this can be merged? Thanks! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D136315/new/ https://reviews.llvm.org/D136315 _

[PATCH] D136315: [clang][Darwin] Try to guess the SDK root with xcrun when unspecified

2022-12-16 Thread Caleb Zulawski via Phabricator via cfe-commits
calebzulawski updated this revision to Diff 483697. calebzulawski added a comment. Looks like the failure was somehow in clangd? Trying to trigger another build. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D136315/new/ https://reviews.llvm.org/D1

[PATCH] D136315: [clang][Darwin] Try to guess the SDK root with xcrun when unspecified

2022-12-15 Thread Caleb Zulawski via Phabricator via cfe-commits
calebzulawski updated this revision to Diff 483416. calebzulawski added a comment. Update user manual Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D136315/new/ https://reviews.llvm.org/D136315 Files: clang/docs/UsersManual.rst clang/lib/Driver

[PATCH] D136315: [clang][Darwin] Try to guess the SDK root with xcrun when unspecified

2022-12-13 Thread Caleb Zulawski via Phabricator via cfe-commits
calebzulawski updated this revision to Diff 482697. calebzulawski added a comment. Update diff for upstream changes Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D136315/new/ https://reviews.llvm.org/D136315 Files: clang/lib/Driver/ToolChains/Dar

[PATCH] D136315: [clang][Darwin] Try to guess the SDK root with xcrun when unspecified

2022-12-13 Thread Caleb Zulawski via Phabricator via cfe-commits
calebzulawski updated this revision to Diff 482650. calebzulawski added a comment. Update comment Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D136315/new/ https://reviews.llvm.org/D136315 Files: clang/lib/Driver/ToolChains/Darwin.cpp clang/te

[PATCH] D136315: [clang][Darwin] Try to guess the SDK root with xcrun when unspecified

2022-11-17 Thread Caleb Zulawski via Phabricator via cfe-commits
calebzulawski added a comment. Is there any update to this? Or maybe someone I should add as a reviewer? Thanks! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D136315/new/ https://reviews.llvm.org/D136315 __

[PATCH] D136315: [clang][Darwin] Try to guess the SDK root with xcrun when unspecified

2022-10-23 Thread Caleb Zulawski via Phabricator via cfe-commits
calebzulawski updated this revision to Diff 469987. calebzulawski added a comment. Move SDK detection to its own test. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D136315/new/ https://reviews.llvm.org/D136315 Files: clang/lib/Driver/ToolChains/

[PATCH] D136315: [clang][Darwin] Try to guess the SDK root with xcrun when unspecified

2022-10-22 Thread Caleb Zulawski via Phabricator via cfe-commits
calebzulawski updated this revision to Diff 469953. calebzulawski added a comment. Try to fix windows test Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D136315/new/ https://reviews.llvm.org/D136315 Files: clang/lib/Driver/ToolChains/Darwin.cpp

[PATCH] D136315: [clang][Darwin] Try to guess the SDK root with xcrun when unspecified

2022-10-22 Thread Caleb Zulawski via Phabricator via cfe-commits
calebzulawski updated this revision to Diff 469948. calebzulawski added a comment. Fix test using `RUN` in `CHECK` prefix Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D136315/new/ https://reviews.llvm.org/D136315 Files: clang/lib/Driver/ToolChai

[PATCH] D136315: [clang][Darwin] Try to guess the SDK root with xcrun when unspecified

2022-10-22 Thread Caleb Zulawski via Phabricator via cfe-commits
calebzulawski marked an inline comment as done. calebzulawski added inline comments. Comment at: clang/lib/Driver/ToolChains/Darwin.cpp:2147 +default: + // We shouldn't get here, unless the target OS doesn't have an SDK. + break; calebzulawski wrote

[PATCH] D136315: [clang][Darwin] Try to guess the SDK root with xcrun when unspecified

2022-10-22 Thread Caleb Zulawski via Phabricator via cfe-commits
calebzulawski updated this revision to Diff 469940. calebzulawski added a comment. Fix formatting, error on unrecognized OS, skip tests if xcrun isn't present. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D136315/new/ https://reviews.llvm.org/D1363

[PATCH] D136315: [clang][Darwin] Try to guess the SDK root with xcrun when unspecified

2022-10-22 Thread Caleb Zulawski via Phabricator via cfe-commits
calebzulawski added inline comments. Comment at: clang/lib/Driver/ToolChains/Darwin.cpp:2147 +default: + // We shouldn't get here, unless the target OS doesn't have an SDK. + break; carlocab wrote: > `llvm_unreachable`? Or `assert`, at least. I'm no

[PATCH] D136315: [clang][Darwin] Try to guess the SDK root with xcrun when unspecified

2022-10-22 Thread Caleb Zulawski via Phabricator via cfe-commits
calebzulawski added inline comments. Comment at: clang/lib/Driver/ToolChains/Darwin.cpp:2120 +Optional SDKName = None; +if (getTriple().isWatchOS()) { + if (getTriple().isSimulatorEnvironment()) tschuett wrote: > Will there be an enum over the Apple

[PATCH] D136315: [clang][Darwin] Try to guess the SDK root with xcrun when unspecified

2022-10-22 Thread Caleb Zulawski via Phabricator via cfe-commits
calebzulawski updated this revision to Diff 469909. calebzulawski added a comment. Use switch when detecting OS. Limit sdkroot test to darwin platforms. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D136315/new/ https://reviews.llvm.org/D136315 Fi

[PATCH] D136315: [clang][Darwin] Try to guess the SDK root with xcrun when unspecified

2022-10-22 Thread Caleb Zulawski via Phabricator via cfe-commits
calebzulawski updated this revision to Diff 469901. calebzulawski added a comment. Change tests to specifically remove `SDKROOT` environment variable. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D136315/new/ https://reviews.llvm.org/D136315 Files

[PATCH] D136315: [clang][Darwin] Try to guess the SDK root with xcrun when unspecified

2022-10-21 Thread Caleb Zulawski via Phabricator via cfe-commits
calebzulawski added a comment. In D136315#3870829 , @ldionne wrote: > Thanks for picking this up! I looked at my local changes and I had started > modifying `inferDeploymentTargetFromSDK`. I had left the comment: > > /// TODO: We should only infer it i

[PATCH] D136315: [clang][Darwin] Try to guess the SDK root with xcrun when unspecified

2022-10-21 Thread Caleb Zulawski via Phabricator via cfe-commits
calebzulawski updated this revision to Diff 469859. calebzulawski added a comment. Changed to not invoke `xcrun` if the SDK name can't be determined. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D136315/new/ https://reviews.llvm.org/D136315 Files:

[PATCH] D136315: [clang][Darwin] Try to guess the SDK root with xcrun when unspecified

2022-10-20 Thread Caleb Zulawski via Phabricator via cfe-commits
calebzulawski added a comment. If `clang -target arm64-apple-ios -isysroot path/to/MacOSX.sdk` changes the target to `x86_64-apple-macos` to match the SDK, that would be very confusing behavior :) I'll have to investigate that function some more. Repository: rG LLVM Github Monorepo CHANGES

[PATCH] D136315: [clang][Darwin] Try to guess the SDK root with xcrun when unspecified

2022-10-20 Thread Caleb Zulawski via Phabricator via cfe-commits
calebzulawski added a comment. That's a good point, I was a little suspicious about that function. I'm not sure it makes sense to infer the target at all from the SDK (e.g. macOS could be x86_64 or arm64) rather than infer the SDK from the target. Rust, for example, disregards `SYSROOT` and ru

[PATCH] D136315: Diff 2

2022-10-19 Thread Caleb Zulawski via Phabricator via cfe-commits
calebzulawski created this revision. Herald added a project: All. calebzulawski requested review of this revision. Herald added subscribers: cfe-commits, MaskRay. Herald added a project: clang. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D136315 Files: clang/lib/Driver/ToolC

[PATCH] D109460: [clang][Darwin] Try to guess the SDK root with xcrun when unspecified

2022-10-15 Thread Caleb Zulawski via Phabricator via cfe-commits
calebzulawski added a comment. Herald added a subscriber: MaskRay. Herald added a project: All. I'm interested in this feature--is there any reason this wasn't completed? If not, I might be able to take over implementing this. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION h