This is an archive of the discontinued LLVM Phabricator instance.

[MinGW] Look for a cross sysroot relative to the clang binary
ClosedPublic

Authored by mstorsjo on Apr 10 2018, 1:46 PM.

Details

Summary

If found, prefer this over looking for a similar gcc later in the system path.

This implements what @martell suggested in D45152 in a much neater way.

Tests still are TBD, but posting this early to see if there's comments. (How do I easily do a test that checks something relative to the clang binary, since I don't control the location of the tested binary when running tests?)

Diff Detail

Repository
rL LLVM

Event Timeline

mstorsjo created this revision.Apr 10 2018, 1:46 PM
mstorsjo updated this revision to Diff 141909.Apr 10 2018, 2:04 PM

Fixed the hardcoded triplet suffix, previously I erroneously had a "-gcc" suffix there.

Ping, any comments on the change itself, or tips on how to create a test for it?

rnk accepted this revision.Apr 17 2018, 1:47 PM

lgtm

This revision is now accepted and ready to land.Apr 17 2018, 1:47 PM
rnk added a comment.Apr 17 2018, 1:51 PM

Sorry, I skipped over the message and looked at the code, which seems pretty straightforward.

Tests still are TBD, but posting this early to see if there's comments. (How do I easily do a test that checks something relative to the clang binary, since I don't control the location of the tested binary when running tests?)

As much fun as it is to create sysroot subtrees in the clang test input directories and test them with -#, I don't feel like they have that much value. I've seen people write tests that do things like `mkdir -p %t/bin ... cp %clang %t/bin/clang && %t/bin/clang -#`, but it's pretty expensive, and the tests are hard to debug and modify.

In D45504#1070198, @rnk wrote:

Sorry, I skipped over the message and looked at the code, which seems pretty straightforward.

Tests still are TBD, but posting this early to see if there's comments. (How do I easily do a test that checks something relative to the clang binary, since I don't control the location of the tested binary when running tests?)

As much fun as it is to create sysroot subtrees in the clang test input directories and test them with -#, I don't feel like they have that much value. I've seen people write tests that do things like `mkdir -p %t/bin ... cp %clang %t/bin/clang && %t/bin/clang -#`, but it's pretty expensive, and the tests are hard to debug and modify.

Yeah, I also agree that's kinda overkill. Proceeding without tests for this then.

This revision was automatically updated to reflect the committed changes.