[PATCH] D157767: [Driver] move Haiku header search path management to the driver

2023-08-15 Thread Brad Smith via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGaa2c701b5dc0: [Driver] move Haiku header search path 
management to the driver (authored by brad).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157767/new/

https://reviews.llvm.org/D157767

Files:
  clang/lib/Driver/ToolChains/Haiku.cpp
  clang/lib/Driver/ToolChains/Haiku.h
  clang/lib/Lex/InitHeaderSearch.cpp

Index: clang/lib/Lex/InitHeaderSearch.cpp
===
--- clang/lib/Lex/InitHeaderSearch.cpp
+++ clang/lib/Lex/InitHeaderSearch.cpp
@@ -279,42 +279,6 @@
 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 @@
   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:
Index: clang/lib/Driver/ToolChains/Haiku.h
===
--- clang/lib/Driver/ToolChains/Haiku.h
+++ clang/lib/Driver/ToolChains/Haiku.h
@@ -26,6 +26,9 @@
 return getTriple().getArch() == llvm::Triple::x86_64;
   }
 
+  void AddClangSystemIncludeArgs(
+  const llvm::opt::ArgList ,
+  llvm::opt::ArgStringList ) const override;
   void addLibCxxIncludePaths(
   const llvm::opt::ArgList ,
   llvm::opt::ArgStringList ) const override;
Index: clang/lib/Driver/ToolChains/Haiku.cpp
===
--- clang/lib/Driver/ToolChains/Haiku.cpp
+++ 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 @@
 
 }
 
+void Haiku::AddClangSystemIncludeArgs(const llvm::opt::ArgList ,
+  llvm::opt::ArgStringList ) const {
+  const Driver  = 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 

[PATCH] D157767: [Driver] move Haiku header search path management to the driver

2023-08-15 Thread Niels Sascha Reedijk via Phabricator via cfe-commits
nielx accepted this revision.
nielx added a comment.
This revision is now accepted and ready to land.

I have applied the patch to a recent checkout of the llvm repository, and I 
then built clang. With this clang build I have built various source files that 
depend on headers that are in the system search paths. I can confirm that the 
compiler was able to find all the referenced headers.

This change looks good to me.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157767/new/

https://reviews.llvm.org/D157767

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D157767: [Driver] move Haiku header search path management to the driver

2023-08-13 Thread Brad Smith via Phabricator via cfe-commits
brad updated this revision to Diff 549757.
brad added a comment.

Removed:
/boot/system/develop/headers/os/arch

Added:
/boot/system/develop/headers/gnu


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157767/new/

https://reviews.llvm.org/D157767

Files:
  clang/lib/Driver/ToolChains/Haiku.cpp
  clang/lib/Driver/ToolChains/Haiku.h
  clang/lib/Lex/InitHeaderSearch.cpp

Index: clang/lib/Lex/InitHeaderSearch.cpp
===
--- clang/lib/Lex/InitHeaderSearch.cpp
+++ clang/lib/Lex/InitHeaderSearch.cpp
@@ -279,42 +279,6 @@
 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 @@
   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:
Index: clang/lib/Driver/ToolChains/Haiku.h
===
--- clang/lib/Driver/ToolChains/Haiku.h
+++ clang/lib/Driver/ToolChains/Haiku.h
@@ -26,6 +26,9 @@
 return getTriple().getArch() == llvm::Triple::x86_64;
   }
 
+  void AddClangSystemIncludeArgs(
+  const llvm::opt::ArgList ,
+  llvm::opt::ArgStringList ) const override;
   void addLibCxxIncludePaths(
   const llvm::opt::ArgList ,
   llvm::opt::ArgStringList ) const override;
Index: clang/lib/Driver/ToolChains/Haiku.cpp
===
--- clang/lib/Driver/ToolChains/Haiku.cpp
+++ 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 @@
 
 }
 
+void Haiku::AddClangSystemIncludeArgs(const llvm::opt::ArgList ,
+  llvm::opt::ArgStringList ) const {
+  const Driver  = 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 

[PATCH] D157767: [Driver] move Haiku header search path management to the driver

2023-08-13 Thread Niels Sascha Reedijk via Phabricator via cfe-commits
nielx added a comment.

I will test the patch and see if it works as expected. Note that we currently 
have the following preset header paths in our GCC port 
.




Comment at: clang/lib/Driver/ToolChains/Haiku.cpp:58
+  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + 
"/boot/system/develop/headers/os/app");
+  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + 
"/boot/system/develop/headers/os/arch");
+  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + 
"/boot/system/develop/headers/os/device");

Not (or no longer) in GCC default sys path, so can be removed.



Comment at: clang/lib/Driver/ToolChains/Haiku.cpp:86
+  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + 
"/boot/system/develop/headers/glibc");
+  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + 
"/boot/system/develop/headers/posix");
+  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + 
"/boot/system/develop/headers");

Missing: /boot/system/develop/headers/gnu


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157767/new/

https://reviews.llvm.org/D157767

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D157767: [Driver] move Haiku header search path management to the driver

2023-08-11 Thread Brad Smith via Phabricator via cfe-commits
brad created this revision.
brad added a reviewer: nielx.
brad added a project: clang.
Herald added a project: All.
brad requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay.

Here is a first cut at moving the Haiku header search path management to the 
driver as has been done for many other OS's to date.

InitHeaderSearch::AddDefaultCIncludePaths() currently does not skip adding 
/usr/local/include as well as /usr/include on Haiku. I installed
Haiku in a VM and see that neither path exists on an initial install. The other 
header paths and contents do exist out of the box. I have
not included those paths when moving the header path management to the driver 
so far.

I have not  built this on Haiku. I am looking for an actual Haiku user to test 
this.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D157767

Files:
  clang/lib/Driver/ToolChains/Haiku.cpp
  clang/lib/Driver/ToolChains/Haiku.h
  clang/lib/Lex/InitHeaderSearch.cpp

Index: clang/lib/Lex/InitHeaderSearch.cpp
===
--- clang/lib/Lex/InitHeaderSearch.cpp
+++ clang/lib/Lex/InitHeaderSearch.cpp
@@ -279,42 +279,6 @@
 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 @@
   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:
Index: clang/lib/Driver/ToolChains/Haiku.h
===
--- clang/lib/Driver/ToolChains/Haiku.h
+++ clang/lib/Driver/ToolChains/Haiku.h
@@ -26,6 +26,9 @@
 return getTriple().getArch() == llvm::Triple::x86_64;
   }
 
+  void AddClangSystemIncludeArgs(
+  const llvm::opt::ArgList ,
+  llvm::opt::ArgStringList ) const override;
   void addLibCxxIncludePaths(
   const llvm::opt::ArgList ,
   llvm::opt::ArgStringList ) const override;
Index: clang/lib/Driver/ToolChains/Haiku.cpp
===
--- clang/lib/Driver/ToolChains/Haiku.cpp
+++ 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 @@
 
 }
 
+void Haiku::AddClangSystemIncludeArgs(const llvm::opt::ArgList ,