[clang] [Hexagon] Disable system include paths (PR #185456)

via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 11 08:26:53 PDT 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Alexey Karyakin (quic-akaryaki)

<details>
<summary>Changes</summary>

Hexagon toolchains are almost always cross-compiling and using system include paths is vrtually always an error. In general, adding implicit paths is confusing and a comment in `InitHeaderSearch::AddDefaultIncludePaths()` suggests that "this code path is going away" and the proper place for path selection is in the driver. The current logic is to use system paths by default but it looks like almost all majors OSes are explictly excluded.

Disable implicit system include paths for Hexagon targets.

---
Full diff: https://github.com/llvm/llvm-project/pull/185456.diff


1 Files Affected:

- (modified) clang/lib/Lex/InitHeaderSearch.cpp (+4) 


``````````diff
diff --git a/clang/lib/Lex/InitHeaderSearch.cpp b/clang/lib/Lex/InitHeaderSearch.cpp
index e30925f4e548c..3b0e0704ff8c4 100644
--- a/clang/lib/Lex/InitHeaderSearch.cpp
+++ b/clang/lib/Lex/InitHeaderSearch.cpp
@@ -249,6 +249,10 @@ bool InitHeaderSearch::ShouldAddDefaultIncludePaths(
   if (triple.isOSDarwin())
     return false;
 
+  // On hexagon, include paths are managed by the driver.
+  if (triple.getArch() == llvm::Triple::hexagon)
+    return false;
+
   return true; // Everything else uses AddDefaultIncludePaths().
 }
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/185456


More information about the cfe-commits mailing list