[clang] aa2c701 - [Driver] move Haiku header search path management to the driver
Brad Smith via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 15 16:59:29 PDT 2023
Author: Brad Smith
Date: 2023-08-15T19:58:40-04:00
New Revision: aa2c701b5dc04330b8ec4084a94d7cbe9cc938eb
URL: https://github.com/llvm/llvm-project/commit/aa2c701b5dc04330b8ec4084a94d7cbe9cc938eb
DIFF: https://github.com/llvm/llvm-project/commit/aa2c701b5dc04330b8ec4084a94d7cbe9cc938eb.diff
LOG: [Driver] move Haiku header search path management to the driver
Also while here sync the header paths with the Haiku GCC configuration.
Added: /boot/system/develop/headers/gnu
Removed: /boot/system/develop/headers/os/arch
https://github.com/haikuports/haikuports/tree/master/sys-devel/gcc/patches
Reviewed By: nielx
Differential Revision: https://reviews.llvm.org/D157767
Added:
Modified:
clang/lib/Driver/ToolChains/Haiku.cpp
clang/lib/Driver/ToolChains/Haiku.h
clang/lib/Lex/InitHeaderSearch.cpp
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/Haiku.cpp b/clang/lib/Driver/ToolChains/Haiku.cpp
index a79f0f7622addc..201b80177d7512 100644
--- a/clang/lib/Driver/ToolChains/Haiku.cpp
+++ b/clang/lib/Driver/ToolChains/Haiku.cpp
@@ -8,6 +8,8 @@
#include "Haiku.h"
#include "CommonArgs.h"
+#include "clang/Config/config.h"
+#include "llvm/Support/Path.h"
using namespace clang::driver;
using namespace clang::driver::toolchains;
@@ -21,6 +23,70 @@ Haiku::Haiku(const Driver &D, const llvm::Triple& Triple, const ArgList &Args)
}
+void Haiku::AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
+ llvm::opt::ArgStringList &CC1Args) const {
+ const Driver &D = getDriver();
+
+ if (DriverArgs.hasArg(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;
+
+ // Add dirs specified via 'configure --with-c-include-dirs'.
+ StringRef CIncludeDirs(C_INCLUDE_DIRS);
+ if (!CIncludeDirs.empty()) {
+ 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;
+ }
+
+ addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/non-packaged/develop/headers");
+ addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os");
+ addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/app");
+ addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/device");
+ addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/drivers");
+ addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/game");
+ addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/interface");
+ addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/kernel");
+ addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/locale");
+ addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/mail");
+ addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/media");
+ addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/midi");
+ addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/midi2");
+ addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/net");
+ addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/opengl");
+ addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/storage");
+ addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/support");
+ addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/translation");
+ addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/add-ons/graphics");
+ addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/add-ons/input_server");
+ addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/add-ons/mail_daemon");
+ addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/add-ons/registrar");
+ addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/add-ons/screen_saver");
+ addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/add-ons/tracker");
+ addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/be_apps/Deskbar");
+ addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/be_apps/NetPositive");
+ addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/be_apps/Tracker");
+ addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/3rdparty");
+ addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/bsd");
+ addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/glibc");
+ addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/gnu");
+ addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/posix");
+ addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers");
+}
+
void Haiku::addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CC1Args) const {
addSystemInclude(DriverArgs, CC1Args,
diff --git a/clang/lib/Driver/ToolChains/Haiku.h b/clang/lib/Driver/ToolChains/Haiku.h
index 669379a216050d..80b4dd1945de23 100644
--- a/clang/lib/Driver/ToolChains/Haiku.h
+++ b/clang/lib/Driver/ToolChains/Haiku.h
@@ -26,6 +26,9 @@ class LLVM_LIBRARY_VISIBILITY Haiku : public Generic_ELF {
return getTriple().getArch() == llvm::Triple::x86_64;
}
+ void AddClangSystemIncludeArgs(
+ const llvm::opt::ArgList &DriverArgs,
+ llvm::opt::ArgStringList &CC1Args) const override;
void addLibCxxIncludePaths(
const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CC1Args) const override;
diff --git a/clang/lib/Lex/InitHeaderSearch.cpp b/clang/lib/Lex/InitHeaderSearch.cpp
index 41382d7cb3fc66..4bfb722754f18d 100644
--- a/clang/lib/Lex/InitHeaderSearch.cpp
+++ b/clang/lib/Lex/InitHeaderSearch.cpp
@@ -279,42 +279,6 @@ void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple,
AddPath(P, System, false);
break;
}
-
- case llvm::Triple::Haiku:
- AddPath("/boot/system/non-packaged/develop/headers", System, false);
- AddPath("/boot/system/develop/headers/os", System, false);
- AddPath("/boot/system/develop/headers/os/app", System, false);
- AddPath("/boot/system/develop/headers/os/arch", System, false);
- AddPath("/boot/system/develop/headers/os/device", System, false);
- AddPath("/boot/system/develop/headers/os/drivers", System, false);
- AddPath("/boot/system/develop/headers/os/game", System, false);
- AddPath("/boot/system/develop/headers/os/interface", System, false);
- AddPath("/boot/system/develop/headers/os/kernel", System, false);
- AddPath("/boot/system/develop/headers/os/locale", System, false);
- AddPath("/boot/system/develop/headers/os/mail", System, false);
- AddPath("/boot/system/develop/headers/os/media", System, false);
- AddPath("/boot/system/develop/headers/os/midi", System, false);
- AddPath("/boot/system/develop/headers/os/midi2", System, false);
- AddPath("/boot/system/develop/headers/os/net", System, false);
- AddPath("/boot/system/develop/headers/os/opengl", System, false);
- AddPath("/boot/system/develop/headers/os/storage", System, false);
- AddPath("/boot/system/develop/headers/os/support", System, false);
- AddPath("/boot/system/develop/headers/os/translation", System, false);
- AddPath("/boot/system/develop/headers/os/add-ons/graphics", System, false);
- AddPath("/boot/system/develop/headers/os/add-ons/input_server", System, false);
- AddPath("/boot/system/develop/headers/os/add-ons/mail_daemon", System, false);
- AddPath("/boot/system/develop/headers/os/add-ons/registrar", System, false);
- AddPath("/boot/system/develop/headers/os/add-ons/screen_saver", System, false);
- AddPath("/boot/system/develop/headers/os/add-ons/tracker", System, false);
- AddPath("/boot/system/develop/headers/os/be_apps/Deskbar", System, false);
- AddPath("/boot/system/develop/headers/os/be_apps/NetPositive", System, false);
- AddPath("/boot/system/develop/headers/os/be_apps/Tracker", System, false);
- AddPath("/boot/system/develop/headers/3rdparty", System, false);
- AddPath("/boot/system/develop/headers/bsd", System, false);
- AddPath("/boot/system/develop/headers/glibc", System, false);
- AddPath("/boot/system/develop/headers/posix", System, false);
- AddPath("/boot/system/develop/headers", System, false);
- break;
case llvm::Triple::RTEMS:
break;
case llvm::Triple::Win32:
@@ -388,6 +352,7 @@ bool InitHeaderSearch::ShouldAddDefaultIncludePaths(
case llvm::Triple::PS4:
case llvm::Triple::PS5:
case llvm::Triple::Fuchsia:
+ case llvm::Triple::Haiku:
case llvm::Triple::Hurd:
case llvm::Triple::Linux:
case llvm::Triple::Solaris:
More information about the cfe-commits
mailing list