[clang] [Clang][Driver] Fix the missing Target-Triple-Level include path resolution in Baremetal Driver (PR #165321)

Petr Hosek via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 19 22:50:51 PST 2025


================
@@ -498,9 +507,13 @@ void BareMetal::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,
         addSystemInclude(DriverArgs, CC1Args, TargetDir.str());
         break;
       }
-      // Add generic path if nothing else succeeded so far.
+      // Add generic paths if nothing else succeeded so far.
       llvm::sys::path::append(Dir, "include", "c++", "v1");
       addSystemInclude(DriverArgs, CC1Args, Dir.str());
+      Dir = SysRootDir;
+      llvm::sys::path::append(Dir, Target, "include", "c++", "v1");
+      if (D.getVFS().exists(Dir))
+        addSystemInclude(DriverArgs, CC1Args, Dir.str());
----------------
petrhosek wrote:

I see, I still think we need to move this logic outside of the multilib loop to avoid adding the include directory multiple times. I think this entire loop might need to be restructured since I don't think it's actually correct, so it might be probably easiest for now to just move the new logic outside.

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


More information about the cfe-commits mailing list