================
@@ -879,8 +879,21 @@ void AMDGPUToolChain::addClangWarningOptions(ArgStringList 
&CC1Args) const {
 
 void AMDGPUToolChain::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
                                                 ArgStringList &CC1Args) const {
-  if (DriverArgs.hasArg(options::OPT_nostdinc) ||
-      DriverArgs.hasArg(options::OPT_nostdlibinc))
+  if (DriverArgs.hasArg(options::OPT_nostdinc))
+    return;
+
+  // Add clang's builtin headers (`stddef.h`, `float.h`, `stdint.h`, ...).
+  // These are compiler-provided headers, not host libc headers.
+  //
+  // Example: an amdgcn compile may still need `float.h`, but it should come
+  // from clang's resource directory, not from the host system's 
`/usr/include`.
+  if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) {
----------------
jhuber6 wrote:

I thought `nostdlibinc` was supposed to be the canonical method to say 'I only 
want the clang builtin headers'? This seems a little redundant. Could 
`-Xarch_device -nostdlibinc` work?

https://github.com/llvm/llvm-project/pull/192821
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to