================
@@ -35,6 +35,24 @@ UEFI::UEFI(const Driver &D, const llvm::Triple &Triple, 
const ArgList &Args)
 
 Tool *UEFI::buildLinker() const { return new tools::uefi::Linker(*this); }
 
+void UEFI::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
+                                     ArgStringList &CC1Args) const {
+  if (DriverArgs.hasArg(options::OPT_nostdinc))
+    return;
+
+  if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) {
+    SmallString<128> Dir(getDriver().ResourceDir);
+    llvm::sys::path::append(Dir, "include");
+    addSystemInclude(DriverArgs, CC1Args, Dir.str());
----------------
Prabhuk wrote:

We have a minimal test here: 
https://github.com/llvm/llvm-project/blob/main/clang/test/Driver/uefi-constructed-args.c

This is the header search paths with this PR. My original goal of this change 
was to remove `/usr/include` and `/usr/local/include` from the search list.

```
[hi on] prabhukr@prabhukr:~/llvm-builds/b2$ ./bin/clang -E -v 
--target=x86_64-uefi - < /dev/null
Fuchsia clang version 20.0.0git (g...@github.com:prabhuk/llvm-project.git 
e30c180214f2ca102ba6fcf1b542db7c5f2ac5fd)
Target: x86_64-unknown-uefi
Thread model: posix
InstalledDir: /usr/local/google/home/prabhukr/llvm-builds/b2/bin
Build config: +assertions
 (in-process)
 "/usr/local/google/home/prabhukr/llvm-builds/b2/bin/llvm" "clang" -cc1 -triple 
x86_64-unknown-uefi -E -disable-free -clear-ast-before-backend -main-file-name 
- -mrelocation-model pic -pic-level 2 -mframe-pointer=all -fmath-errno 
-ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 
-target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb 
-fdebug-compilation-dir=/usr/local/google/home/prabhukr/llvm-builds/b2 -v 
-fcoverage-compilation-dir=/usr/local/google/home/prabhukr/llvm-builds/b2 
-resource-dir /usr/local/google/home/prabhukr/llvm-builds/b2/lib/clang/20 
-internal-isystem 
/usr/local/google/home/prabhukr/llvm-builds/b2/lib/clang/20/include 
-ferror-limit 19 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf 
-fcolor-diagnostics -faddrsig -o - -x c -
clang -cc1 version 20.0.0git based upon LLVM 20.0.0git default target 
x86_64-unknown-linux-gnu
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/google/home/prabhukr/llvm-builds/b2/lib/clang/20/include
End of search list.
# 1 "<stdin>"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 389 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "<stdin>" 2

```


https://github.com/llvm/llvm-project/pull/111473
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to