This is an archive of the discontinued LLVM Phabricator instance.

[clang] [test] Pass -ccc-install-dir in mac compilation db test
ClosedPublic

Authored by mgorny on Jan 20 2019, 5:48 AM.

Details

Summary

Pass -ccc-install-dir explicitly as the compilation database code does
not pass argv[0] to getMainExecutable(), while some systems require it
to return the correct path. Since the relevant code is apparently only
applicable to Darwin, just pass correct -ccc-install-dir to make
the tests pass on *BSD systems.

Diff Detail

Event Timeline

mgorny created this revision.Jan 20 2019, 5:48 AM
krytarowski accepted this revision.Jan 20 2019, 5:50 AM
This revision is now accepted and ready to land.Jan 20 2019, 5:50 AM
ilya-biryukov added a comment.EditedJan 21 2019, 1:59 AM

LGTM to unbreak the tests on *BSD, but could you please leave a comment?
It would probably be best to take argv[0] into account on *BSD systems as well (possibly only if clang could not be found).

At least if that's the behaviour on all other systems.

test/Tooling/clang-check-mac-libcxx-fixed-compilation-db.cpp
15

Could you leave a comment this is passed to unbreak *BSD tests?

LGTM to unbreak the tests on *BSD, but could you please leave a comment?
It would probably be best to take argv[0] into account on *BSD systems as well (possibly only if clang could not be found).

At least if that's the behaviour on all other systems.

Actually, it works on other systems because they don't use argv[0]. The problem is in compilation db code using getMainExecutable() in ctor without passing the real argv to it.

Actually, it works on other systems because they don't use argv[0]. The problem is in compilation db code using getMainExecutable() in ctor without passing the real argv to it.

But it does so in all OSes and still manages find libc++, right? What's different for *BSD?

One possible fix is to start passing proper argv[0] into getMainExecutable, but my expectation is that using clang there was intentional: the tooling library tries to fallback to the system clang in that case.

Was confused about your comment, so it works on other systems because they don't rely on argv[0] to get the path to main executable. Got you.

mgorny updated this revision to Diff 182785.Jan 21 2019, 6:29 AM

Added a comment as requested.

mgorny marked an inline comment as done.Jan 21 2019, 6:30 AM

Was confused about your comment, so it works on other systems because they don't rely on argv[0] to get the path to main executable. Got you.

Exactly.

This revision was automatically updated to reflect the committed changes.