[PATCH] D159414: Haiku: Fixes for header / library paths

2023-09-05 Thread Brad Smith via Phabricator via cfe-commits
brad added inline comments.



Comment at: clang/lib/Driver/ToolChains/Haiku.cpp:24-25
 
+  getFilePaths().push_back(concat(getDriver().SysRoot, "/boot/system/lib"));
+  getFilePaths().push_back(concat(getDriver().SysRoot, 
"/boot/system/develop/lib"));
 }

trungnt2910 wrote:
> Should we also add the corresponding non-packaged paths, like 
> `/boot/system/non-packaged/lib` and `/boot/system/non-packaged/develop/lib`?
> 
> The latest GCC toolchain on Haiku does **not** do it, but neither does it 
> recognize non-packaged files for the headers.
> Should we also add the corresponding non-packaged paths, like 
> `/boot/system/non-packaged/lib` and `/boot/system/non-packaged/develop/lib`?
> 
> The latest GCC toolchain on Haiku does **not** do it, but neither does it 
> recognize non-packaged files for the headers.

The second path does not exist and the first path has some sub-dirs (Perl / 
Python) but does not have any libraries.

I'm using what the LLVM patches had. I think we're good as is as a start.



Comment at: clang/lib/Driver/ToolChains/Haiku.cpp:24-25
 
+  getFilePaths().push_back(concat(getDriver().SysRoot, "/boot/system/lib"));
+  getFilePaths().push_back(concat(getDriver().SysRoot, 
"/boot/system/develop/lib"));
 }

brad wrote:
> trungnt2910 wrote:
> > Should we also add the corresponding non-packaged paths, like 
> > `/boot/system/non-packaged/lib` and `/boot/system/non-packaged/develop/lib`?
> > 
> > The latest GCC toolchain on Haiku does **not** do it, but neither does it 
> > recognize non-packaged files for the headers.
> > Should we also add the corresponding non-packaged paths, like 
> > `/boot/system/non-packaged/lib` and `/boot/system/non-packaged/develop/lib`?
> > 
> > The latest GCC toolchain on Haiku does **not** do it, but neither does it 
> > recognize non-packaged files for the headers.
> 
> The second path does not exist and the first path has some sub-dirs (Perl / 
> Python) but does not have any libraries.
> 
> I'm using what the LLVM patches had. I think we're good as is as a start.
> Should we also add the corresponding non-packaged paths, like 
> `/boot/system/non-packaged/lib` and `/boot/system/non-packaged/develop/lib`?
> 
> The latest GCC toolchain on Haiku does **not** do it, but neither does it 
> recognize non-packaged files for the headers.




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159414

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


[PATCH] D159414: Haiku: Fixes for header / library paths

2023-09-05 Thread Trung Nguyen via Phabricator via cfe-commits
trungnt2910 added inline comments.



Comment at: clang/lib/Driver/ToolChains/Haiku.cpp:85-86
+   "/boot/system/develop/headers/os/net"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+   "/boot/system/develop/headers/os/opengl"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,

brad wrote:
> trungnt2910 wrote:
> > Not included by GCC, and not found in my Haiku installation.
> > 
> > I don't know what this is for though, so probably just keep it until 
> > someone else says otherwise.
> > Not included by GCC, and not found in my Haiku installation.
> > 
> > I don't know what this is for though, so probably just keep it until 
> > someone else says otherwise.
> 
> This is referring to the os/opengl directory?
Yes, I was trying to select lines 85-86.



Comment at: clang/lib/Driver/ToolChains/Haiku.cpp:105-106
+   "/boot/system/develop/headers/os/add-ons/tracker"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+   "/boot/system/develop/headers/os/be_apps/Deskbar"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,

brad wrote:
> trungnt2910 wrote:
> > This seems to have been removed from Haiku, see: 
> > https://github.com/haiku/haiku/commit/a3e794ae459fec76826407f8ba8c94cd3535f128
> > 
> > The latest Haiku GCC toolchain does not include it.
> > This seems to have been removed from Haiku, see: 
> > https://github.com/haiku/haiku/commit/a3e794ae459fec76826407f8ba8c94cd3535f128
> > 
> > The latest Haiku GCC toolchain does not include it.
> 
> https://github.com/haikuports/haikuports/blob/master/sys-devel/gcc/patches/gcc-13.2.0_2023_08_10.patchset
> 
> I still see the path listed in the GCC configs.
> 
> But I see in the Haiku I have installed in my VM that the path indeed is gone.
I was comparing to the output of `gcc -v`, now I see what's happening:

```
ignoring nonexistent directory "/boot/system/non-packaged/develop/headers"
ignoring nonexistent directory "/boot/system/develop/headers/os/opengl"
ignoring nonexistent directory "/boot/system/develop/headers/os/be_apps/Deskbar"
ignoring nonexistent directory "/boot/system/develop/headers/3rdparty"
```

If GCC is doing that, I think we should keep things as they are.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159414

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


[PATCH] D159414: Haiku: Fixes for header / library paths

2023-09-05 Thread Brad Smith via Phabricator via cfe-commits
brad added inline comments.



Comment at: clang/lib/Driver/ToolChains/Haiku.cpp:85-86
+   "/boot/system/develop/headers/os/net"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+   "/boot/system/develop/headers/os/opengl"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,

trungnt2910 wrote:
> Not included by GCC, and not found in my Haiku installation.
> 
> I don't know what this is for though, so probably just keep it until someone 
> else says otherwise.
> Not included by GCC, and not found in my Haiku installation.
> 
> I don't know what this is for though, so probably just keep it until someone 
> else says otherwise.

This is referring to the os/opengl directory?



Comment at: clang/lib/Driver/ToolChains/Haiku.cpp:105-106
+   "/boot/system/develop/headers/os/add-ons/tracker"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+   "/boot/system/develop/headers/os/be_apps/Deskbar"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,

trungnt2910 wrote:
> This seems to have been removed from Haiku, see: 
> https://github.com/haiku/haiku/commit/a3e794ae459fec76826407f8ba8c94cd3535f128
> 
> The latest Haiku GCC toolchain does not include it.
> This seems to have been removed from Haiku, see: 
> https://github.com/haiku/haiku/commit/a3e794ae459fec76826407f8ba8c94cd3535f128
> 
> The latest Haiku GCC toolchain does not include it.

https://github.com/haikuports/haikuports/blob/master/sys-devel/gcc/patches/gcc-13.2.0_2023_08_10.patchset

I still see the path listed in the GCC configs.

But I see in the Haiku I have installed in my VM that the path indeed is gone.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159414

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


[PATCH] D159414: Haiku: Fixes for header / library paths

2023-09-05 Thread Trung Nguyen via Phabricator via cfe-commits
trungnt2910 added a comment.

I'm not the Haiku toolchain expert here , all I can do is comparing this with 
what the GCC toolchain for Haiku does.




Comment at: clang/lib/Driver/ToolChains/Haiku.cpp:24-25
 
+  getFilePaths().push_back(concat(getDriver().SysRoot, "/boot/system/lib"));
+  getFilePaths().push_back(concat(getDriver().SysRoot, 
"/boot/system/develop/lib"));
 }

Should we also add the corresponding non-packaged paths, like 
`/boot/system/non-packaged/lib` and `/boot/system/non-packaged/develop/lib`?

The latest GCC toolchain on Haiku does **not** do it, but neither does it 
recognize non-packaged files for the headers.



Comment at: clang/lib/Driver/ToolChains/Haiku.cpp:85-86
+   "/boot/system/develop/headers/os/net"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+   "/boot/system/develop/headers/os/opengl"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,

Not included by GCC, and not found in my Haiku installation.

I don't know what this is for though, so probably just keep it until someone 
else says otherwise.



Comment at: clang/lib/Driver/ToolChains/Haiku.cpp:105-106
+   "/boot/system/develop/headers/os/add-ons/tracker"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+   "/boot/system/develop/headers/os/be_apps/Deskbar"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,

This seems to have been removed from Haiku, see: 
https://github.com/haiku/haiku/commit/a3e794ae459fec76826407f8ba8c94cd3535f128

The latest Haiku GCC toolchain does not include it.



Comment at: clang/test/Driver/haiku.c:28
+// CHECK-C-HEADER-PATH: "-internal-isystem" 
"/boot/system/develop/headers/os/add-ons/tracker"
+// CHECK-C-HEADER-PATH: "-internal-isystem" 
"/boot/system/develop/headers/os/be_apps/Deskbar"
+// CHECK-C-HEADER-PATH: "-internal-isystem" 
"/boot/system/develop/headers/os/be_apps/NetPositive"

Should also remove this if the corresponding line in `Haiku.cpp` is removed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159414

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


[PATCH] D159414: Haiku: Fixes for header / library paths

2023-09-04 Thread Brad Smith via Phabricator via cfe-commits
brad updated this revision to Diff 555794.
brad edited the summary of this revision.
brad added a comment.

Separate out the GCC path handling.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159414

Files:
  clang/lib/Driver/ToolChains/Haiku.cpp
  
clang/test/Driver/Inputs/haiku_x86_64_tree/boot/system/develop/headers/c++/v1/.keep
  clang/test/Driver/haiku.c
  clang/test/Driver/haiku.cpp

Index: clang/test/Driver/haiku.cpp
===
--- /dev/null
+++ clang/test/Driver/haiku.cpp
@@ -0,0 +1,11 @@
+// Check the C++ header path (libstdc++)
+// RUN: %clang++ --target=x86_64-unknown-haiku -### %s 2>&1 \
+// RUN:   --sysroot=%S/Inputs/haiku_x86_64_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LIBSTDCXX-HEADER-PATH %s
+// CHECK-LIBSTDCXX-HEADER-PATH: "-internal-isystem" "[[SYSROOT:[^"]+]]/boot/system/develop/headers/c++"
+
+// Check the C++ header path (when using libc++)
+// RUN: %clang++ --target=x86_64-unknown-haiku --stdlib=libc++ -### %s 2>&1 \
+// RUN:   --sysroot=%S/Inputs/haiku_x86_64_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LIBCXX-HEADER-PATH %s
+// CHECK-LIBCXX-HEADER-PATH: "-internal-isystem" "[[SYSROOT:[^"]+]]/boot/system/develop/headers/c++/v1"
Index: clang/test/Driver/haiku.c
===
--- /dev/null
+++ clang/test/Driver/haiku.c
@@ -0,0 +1,36 @@
+// Check the C header paths
+// RUN: %clang --target=x86_64-unknown-haiku -### %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-C-HEADER-PATH %s
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/non-packaged/develop/headers"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/app"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/device"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/drivers"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/game"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/interface"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/kernel"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/locale"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/mail"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/media"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/midi"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/midi2"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/net"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/opengl"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/storage"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/support"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/translation"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/add-ons/graphics"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/add-ons/input_server"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/add-ons/mail_daemon"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/add-ons/registrar"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/add-ons/screen_saver"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/add-ons/tracker"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/be_apps/Deskbar"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/be_apps/NetPositive"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/be_apps/Tracker"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/3rdparty"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/bsd"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/glibc"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/gnu"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/posix"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers"
Index: clang/lib/Driver/ToolChains/Haiku.cpp
===
--- clang/lib/Driver/ToolChains/Haiku.cpp
+++ clang/lib/Driver/ToolChains/Haiku.cpp
@@ -21,6 +21,8 @@
 Haiku::Haiku(const Driver , const llvm::Triple& Triple, const ArgList )
   : Generic_ELF(D, Triple, Args) {
 
+  getFilePaths().push_back(concat(getDriver().SysRoot, "/boot/system/lib"));
+  

[PATCH] D159414: Haiku: Fixes for header / library paths

2023-09-04 Thread Brad Smith via Phabricator via cfe-commits
brad updated this revision to Diff 555785.
brad added a comment.

Add some C++ header path tests.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159414

Files:
  clang/lib/Driver/ToolChains/Haiku.cpp
  
clang/test/Driver/Inputs/haiku_x86_64_tree/boot/system/develop/headers/c++/v1/.keep
  clang/test/Driver/haiku.c
  clang/test/Driver/haiku.cpp

Index: clang/test/Driver/haiku.cpp
===
--- /dev/null
+++ clang/test/Driver/haiku.cpp
@@ -0,0 +1,11 @@
+// Check the C++ header path (libstdc++)
+// RUN: %clang++ --target=x86_64-unknown-haiku -### %s 2>&1 \
+// RUN:   --sysroot=%S/Inputs/haiku_x86_64_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LIBSTDCXX-HEADER-PATH %s
+// CHECK-LIBSTDCXX-HEADER-PATH: "-internal-isystem" "[[SYSROOT:[^"]+]]/boot/system/develop/headers/c++"
+
+// Check the C++ header path (when using libc++)
+// RUN: %clang++ --target=x86_64-unknown-haiku --stdlib=libc++ -### %s 2>&1 \
+// RUN:   --sysroot=%S/Inputs/haiku_x86_64_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LIBCXX-HEADER-PATH %s
+// CHECK-LIBCXX-HEADER-PATH: "-internal-isystem" "[[SYSROOT:[^"]+]]/boot/system/develop/headers/c++/v1"
Index: clang/test/Driver/haiku.c
===
--- /dev/null
+++ clang/test/Driver/haiku.c
@@ -0,0 +1,36 @@
+// Check the C header paths
+// RUN: %clang --target=x86_64-unknown-haiku -### %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-C-HEADER-PATH %s
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/non-packaged/develop/headers"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/app"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/device"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/drivers"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/game"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/interface"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/kernel"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/locale"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/mail"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/media"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/midi"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/midi2"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/net"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/opengl"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/storage"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/support"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/translation"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/add-ons/graphics"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/add-ons/input_server"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/add-ons/mail_daemon"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/add-ons/registrar"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/add-ons/screen_saver"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/add-ons/tracker"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/be_apps/Deskbar"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/be_apps/NetPositive"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/be_apps/Tracker"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/3rdparty"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/bsd"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/glibc"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/gnu"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/posix"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers"
Index: clang/lib/Driver/ToolChains/Haiku.cpp
===
--- clang/lib/Driver/ToolChains/Haiku.cpp
+++ clang/lib/Driver/ToolChains/Haiku.cpp
@@ -21,6 +21,13 @@
 Haiku::Haiku(const Driver , const llvm::Triple& Triple, const ArgList )
   : Generic_ELF(D, Triple, Args) {
 
+  GCCInstallation.init(Triple, Args);
+
+  getFilePaths().push_back(concat(getDriver().SysRoot, "/boot/system/lib"));
+  getFilePaths().push_back(concat(getDriver().SysRoot, 

[PATCH] D159414: Haiku: Fixes for header / library paths

2023-09-04 Thread Brad Smith via Phabricator via cfe-commits
brad updated this revision to Diff 555783.
Herald added a subscriber: ormris.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159414

Files:
  clang/lib/Driver/ToolChains/Haiku.cpp
  clang/test/Driver/haiku.c
  clang/test/Driver/haiku.cpp

Index: clang/test/Driver/haiku.cpp
===
--- /dev/null
+++ clang/test/Driver/haiku.cpp
@@ -0,0 +1,4 @@
+// Check the C++ header path when using libc++
+// RUN: %clang++ --target=x86_64-unknown-haiku --stdlib=libc++ -### %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-LIBCXX-HEADER-PATH %s
+// CHECK-LIBCXX-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/c++/v1"
Index: clang/test/Driver/haiku.c
===
--- /dev/null
+++ clang/test/Driver/haiku.c
@@ -0,0 +1,36 @@
+// Check the C header paths
+// RUN: %clang --target=x86_64-unknown-haiku -### %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-C-HEADER-PATH %s
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/non-packaged/develop/headers"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/app"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/device"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/drivers"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/game"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/interface"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/kernel"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/locale"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/mail"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/media"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/midi"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/midi2"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/net"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/opengl"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/storage"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/support"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/translation"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/add-ons/graphics"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/add-ons/input_server"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/add-ons/mail_daemon"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/add-ons/registrar"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/add-ons/screen_saver"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/add-ons/tracker"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/be_apps/Deskbar"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/be_apps/NetPositive"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/be_apps/Tracker"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/3rdparty"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/bsd"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/glibc"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/gnu"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/posix"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers"
Index: clang/lib/Driver/ToolChains/Haiku.cpp
===
--- clang/lib/Driver/ToolChains/Haiku.cpp
+++ clang/lib/Driver/ToolChains/Haiku.cpp
@@ -21,6 +21,13 @@
 Haiku::Haiku(const Driver , const llvm::Triple& Triple, const ArgList )
   : Generic_ELF(D, Triple, Args) {
 
+  GCCInstallation.init(Triple, Args);
+
+  getFilePaths().push_back(concat(getDriver().SysRoot, "/boot/system/lib"));
+  getFilePaths().push_back(concat(getDriver().SysRoot, "/boot/system/develop/lib"));
+
+  if (GCCInstallation.isValid())
+getFilePaths().push_back(GCCInstallation.getInstallPath().str());
 }
 
 void Haiku::AddClangSystemIncludeArgs(const llvm::opt::ArgList ,
@@ -52,49 +59,82 @@
 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 + 

[PATCH] D159414: Haiku: Fixes for header / library paths

2023-09-04 Thread Brad Smith via Phabricator via cfe-commits
brad updated this revision to Diff 555689.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159414

Files:
  clang/lib/Driver/ToolChains/Haiku.cpp

Index: clang/lib/Driver/ToolChains/Haiku.cpp
===
--- clang/lib/Driver/ToolChains/Haiku.cpp
+++ clang/lib/Driver/ToolChains/Haiku.cpp
@@ -21,6 +21,13 @@
 Haiku::Haiku(const Driver , const llvm::Triple& Triple, const ArgList )
   : Generic_ELF(D, Triple, Args) {
 
+  GCCInstallation.init(Triple, Args);
+
+  getFilePaths().push_back(concat(getDriver().SysRoot, "/boot/system/lib"));
+  getFilePaths().push_back(concat(getDriver().SysRoot, "/boot/system/develop/lib"));
+
+  if (GCCInstallation.isValid())
+getFilePaths().push_back(GCCInstallation.getInstallPath().str());
 }
 
 void Haiku::AddClangSystemIncludeArgs(const llvm::opt::ArgList ,
@@ -52,49 +59,82 @@
 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");
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+   "/boot/system/non-packaged/develop/headers"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+   "/boot/system/develop/headers/os"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+   "/boot/system/develop/headers/os/app"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+   "/boot/system/develop/headers/os/device"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+   "/boot/system/develop/headers/os/drivers"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+   "/boot/system/develop/headers/os/game"));
+  addSystemInclude(DriverArgs, CC1Args, 

[PATCH] D159414: Haiku: Fixes for header / library paths

2023-09-04 Thread Brad Smith via Phabricator via cfe-commits
brad created this revision.
brad added reviewers: nielx, korli, kallisti5.
brad added a project: clang.
Herald added a project: All.
brad requested review of this revision.
Herald added a subscriber: MaskRay.

Some fixes for the header / library paths..

- Use concat macro for all paths
- Correct the C++ header paths
- Add library path and GCC path handling


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D159414

Files:
  clang/lib/Driver/ToolChains/Haiku.cpp

Index: clang/lib/Driver/ToolChains/Haiku.cpp
===
--- clang/lib/Driver/ToolChains/Haiku.cpp
+++ clang/lib/Driver/ToolChains/Haiku.cpp
@@ -21,6 +21,13 @@
 Haiku::Haiku(const Driver , const llvm::Triple& Triple, const ArgList )
   : Generic_ELF(D, Triple, Args) {
 
+  GCCInstallation.init(Triple, Args);
+
+  getFilePaths().push_back(concat(getDriver().SysRoot, "/boot/system/lib"));
+  getFilePaths().push_back(concat(getDriver().SysRoot, "/boot/system/develop/lib"));
+
+  if (GCCInstallation.isValid())
+getFilePaths().push_back(GCCInstallation.getInstallPath().str());
 }
 
 void Haiku::AddClangSystemIncludeArgs(const llvm::opt::ArgList ,
@@ -52,49 +59,82 @@
 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");
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+   "/boot/system/non-packaged/develop/headers"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+   "/boot/system/develop/headers/os"));
+  addSystemInclude(DriverArgs, CC1Args, conact(D.SysRoot,
+   "/boot/system/develop/headers/os/app"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+   "/boot/system/develop/headers/os/device"));
+  addSystemInclude(DriverArgs, CC1Args,