================ @@ -2494,6 +2494,19 @@ void DarwinClang::AddClangCXXStdlibIncludeArgs( << "\"\n"; } + // Check for the folder where the executable is located, if different. + if (getDriver().getInstalledDir() != getDriver().Dir) { + InstallBin = llvm::StringRef(getDriver().Dir.c_str()); + llvm::sys::path::append(InstallBin, "..", "include", "c++", "v1"); + if (getVFS().exists(InstallBin)) { + addSystemInclude(DriverArgs, CC1Args, InstallBin); + return; + } else if (DriverArgs.hasArg(options::OPT_v)) { + llvm::errs() << "ignoring nonexistent directory \"" << InstallBin + << "\"\n"; + } + } + // Otherwise, check for (2) llvm::SmallString<128> SysrootUsr = Sysroot; llvm::sys::path::append(SysrootUsr, "usr", "include", "c++", "v1"); ---------------- ldionne wrote:
I think you probably want to add new tests in `clang/test/Driver/darwin-header-search-libcxx.cpp`. You also mentioned that other platforms (e.g. Linux?) handle search paths this way, right? Can you show where this is handled? They might have some tests you could take inspiration from? https://github.com/llvm/llvm-project/pull/70817 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits