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

Alexey Karyakin via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 9 09:52:01 PDT 2026


https://github.com/quic-akaryaki created https://github.com/llvm/llvm-project/pull/185456

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.

>From 8568b36abb2701e7ce90a8f0753b177ddcbce932 Mon Sep 17 00:00:00 2001
From: Alexey Karyakin <akaryaki at qti.qualcomm.com>
Date: Mon, 9 Mar 2026 09:48:26 -0700
Subject: [PATCH] [Hexagon] Disable system include paths

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.
---
 clang/lib/Lex/InitHeaderSearch.cpp | 4 ++++
 1 file changed, 4 insertions(+)

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().
 }
 



More information about the cfe-commits mailing list