Open Quuxplusone opened 9 years ago
Bugzilla Link | PR23691 |
Status | NEW |
Importance | P normal |
Reported by | Bernhard Rosenkraenzer (bero@linaro.org) |
Reported on | 2015-05-28 17:40:24 -0700 |
Last modified on | 2015-05-28 17:52:38 -0700 |
Version | trunk |
Hardware | PC Linux |
CC | llvm-bugs@lists.llvm.org |
Fixed by commit(s) | |
Attachments | |
Blocks | |
Blocked by | |
See also |
Looking at the code, this seems to be intentional (but I'd still argue it's
questionable), Linux::AddClangCXXStdlibIncludeArgs in
tools/clang/lib/Driver/ToolChains.cpp has the following code:
if (GetCXXStdlibType(DriverArgs) == ToolChain::CST_Libcxx) {
const std::string LibCXXIncludePathCandidates[] = {
// The primary location is within the Clang installation.
// FIXME: We shouldn't hard code 'v1' here to make Clang future proof to
// newer ABI versions.
getDriver().Dir + "/../include/c++/v1",
// We also check the system as for a long time this is the only place Clang looked.
// FIXME: We should really remove this. It doesn't make any sense.
getDriver().SysRoot + "/usr/include/c++/v1"
};
So it intentionally looks in the clang installation's directory first, and only
then considers anything sysroot-ed.
I'd argue the sysroot-ed version is preferable because there may be a need to
use a specific different version of libc++ headers on one particular target
(e.g. patched headers for a Linux+musl environment, or an experimental newer
version for a newly supported target), looking in the clang installation
directory forces the same libc++ headers on any target supported by this clang
installation.