================ @@ -296,6 +300,47 @@ void BareMetal::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs, return; const Driver &D = getDriver(); + std::string Target = getTripleString(); + + auto AddCXXIncludePath = [&](StringRef Path) { + std::string Version = detectLibcxxVersion(Path); + if (Version.empty()) + return; + + // First add the per-target multilib include dir. + if (!SelectedMultilibs.empty() && !SelectedMultilibs.back().isDefault()) { + const Multilib &M = SelectedMultilibs.back(); + SmallString<128> TargetDir(Path); + llvm::sys::path::append(TargetDir, Target, M.gccSuffix(), "c++", Version); + if (getVFS().exists(TargetDir)) { + addSystemInclude(DriverArgs, CC1Args, TargetDir); + } + } + + // Second add the per-target include dir. + SmallString<128> TargetDir(Path); + llvm::sys::path::append(TargetDir, Target, "c++", Version); + if (getVFS().exists(TargetDir)) + addSystemInclude(DriverArgs, CC1Args, TargetDir); + + // Third the generic one. + SmallString<128> Dir(Path); + llvm::sys::path::append(Dir, "c++", Version); + addSystemInclude(DriverArgs, CC1Args, Dir); ---------------- nickdesaulniers wrote:
Do you want to check that `Dir` exists before you add it, like you do for both `TargetDir` above? https://github.com/llvm/llvm-project/pull/96736 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits