brad created this revision. brad added a reviewer: devnexen. brad added a project: clang. Herald added a project: All. brad requested review of this revision. Herald added a subscriber: MaskRay.
As has been done for other OS's. Move the header path management to the driver. Also I noticed with https://reviews.llvm.org/D89690 that the library paths were updated for GCC 8, but the C++ header path was not. So I also fixed that while here. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D158376 Files: clang/lib/Driver/ToolChains/DragonFly.cpp clang/lib/Driver/ToolChains/DragonFly.h clang/lib/Lex/InitHeaderSearch.cpp
Index: clang/lib/Lex/InitHeaderSearch.cpp =================================================================== --- clang/lib/Lex/InitHeaderSearch.cpp +++ clang/lib/Lex/InitHeaderSearch.cpp @@ -329,9 +329,6 @@ break; } break; - case llvm::Triple::DragonFly: - AddPath("/usr/include/c++/5.0", CXXSystem, false); - break; case llvm::Triple::Minix: AddGnuCPlusPlusIncludePaths("/usr/gnu/include/c++/4.4.3", "", "", "", triple); @@ -345,6 +342,7 @@ const llvm::Triple &triple) { switch (triple.getOS()) { case llvm::Triple::AIX: + case llvm::Triple::DragonFly: case llvm::Triple::Emscripten: case llvm::Triple::FreeBSD: case llvm::Triple::NetBSD: Index: clang/lib/Driver/ToolChains/DragonFly.h =================================================================== --- clang/lib/Driver/ToolChains/DragonFly.h +++ clang/lib/Driver/ToolChains/DragonFly.h @@ -55,6 +55,13 @@ bool IsMathErrnoDefault() const override { return false; } + void + AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, + llvm::opt::ArgStringList &CC1Args) const override; + void addLibStdCxxIncludePaths( + const llvm::opt::ArgList &DriverArgs, + llvm::opt::ArgStringList &CC1Args) const override; + protected: Tool *buildAssembler() const override; Tool *buildLinker() const override; Index: clang/lib/Driver/ToolChains/DragonFly.cpp =================================================================== --- clang/lib/Driver/ToolChains/DragonFly.cpp +++ clang/lib/Driver/ToolChains/DragonFly.cpp @@ -8,10 +8,12 @@ #include "DragonFly.h" #include "CommonArgs.h" +#include "clang/Config/config.h" #include "clang/Driver/Compilation.h" #include "clang/Driver/Driver.h" #include "clang/Driver/Options.h" #include "llvm/Option/ArgList.h" +#include "llvm/Support/Path.h" using namespace clang::driver; using namespace clang::driver::tools; @@ -195,6 +197,46 @@ getFilePaths().push_back("/usr/lib/gcc80"); } +void DragonFly::AddClangSystemIncludeArgs( + const llvm::opt::ArgList &DriverArgs, + llvm::opt::ArgStringList &CC1Args) const { + const Driver &D = getDriver(); + + if (DriverArgs.hasArg(clang::driver::options::OPT_nostdinc)) + return; + + if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) { + SmallString<128> Dir(D.ResourceDir); + llvm::sys::path::append(Dir, "include"); + addSystemInclude(DriverArgs, CC1Args, Dir.str()); + } + + if (DriverArgs.hasArg(options::OPT_nostdlibinc)) + return; + + // Check for configure-time C include directories. + StringRef CIncludeDirs(C_INCLUDE_DIRS); + if (CIncludeDirs != "") { + SmallVector<StringRef, 5> dirs; + CIncludeDirs.split(dirs, ":"); + for (StringRef dir : dirs) { + StringRef Prefix = + llvm::sys::path::is_absolute(dir) ? StringRef(D.SysRoot) : ""; + addExternCSystemInclude(DriverArgs, CC1Args, Prefix + dir); + } + return; + } + + addExternCSystemInclude(DriverArgs, CC1Args, + concat(D.SysRoot, "/usr/include")); +} + +void DragonFly::addLibStdCxxIncludePaths(const llvm::opt::ArgList &DriverArgs, + llvm::opt::ArgStringList &CC1Args) const { + addLibStdCXXIncludePaths(getDriver().SysRoot + "/usr/include/c++/8.0", "", "", + DriverArgs, CC1Args); +} + Tool *DragonFly::buildAssembler() const { return new tools::dragonfly::Assembler(*this); }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits