This is an archive of the discontinued LLVM Phabricator instance.

[clang] Avoid defining duplicate header search paths for libc++ on Darwin
AbandonedPublic

Authored by ldionne on Apr 23 2019, 11:24 AM.

Details

Reviewers
jfb
EricWF
Summary

Before this patch, we would add both <toolchain>/usr/include/c++/v1
and /usr/include/c++/v1 to the header search paths for C++. The
toolchain path is added by the Driver and the /usr/include path
was added in CC1, a remnant of the non-refactoring of search paths
on Darwin. This patch removes /usr/include/c++/v1, since we should
be only looking for the libc++ headers beside the toolchain on Darwin.

The patch also adds basic tests validating that the right -internal-isystem
is passed from the Driver to CC1 for libc++. Once we refactor the rest of
the header search logic to be passed as -internal-isystem from the Driver
to CC1, we can add more tests to check that e.g. C headers are taken from
the SDK, etc..

Event Timeline

ldionne created this revision.Apr 23 2019, 11:24 AM
Herald added a project: Restricted Project. · View Herald Transcript

I will build a significant codebase with the change and report on the results, since we lack good tests for the removal of /usr/include/c++/v1.

ldionne abandoned this revision.Apr 30 2019, 9:16 AM

I decided to use a different approach and first refactor the header search logic from CC1 to the driver. A patch should come eventually when I've tested it properly.