[clang] [Multilib] Extend the Multilib system to support an IncludeDirs field. (PR #146651)

Petr Hosek via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 4 01:21:01 PST 2025


================
@@ -417,10 +417,20 @@ void BareMetal::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
   const SmallString<128> SysRootDir(computeSysRoot());
   if (!SysRootDir.empty()) {
     for (const Multilib &M : getOrderedMultilibs()) {
-      SmallString<128> Dir(SysRootDir);
-      llvm::sys::path::append(Dir, M.includeSuffix());
-      llvm::sys::path::append(Dir, "include");
-      addSystemInclude(DriverArgs, CC1Args, Dir.str());
+      if (!M.includeDirs().empty()) {
+        // Add include directories specified in multilib.yaml under the
+        // 'IncludeDirs' field
----------------
petrhosek wrote:

This is just a very minor nit, but one the deliberate design decisions we made during the implementation of `multilib.yaml` was to keep the `MultilibBuilder` object interface as an alternative way to initialize the multilibs and this API is still being used e.g. by RISC-V. Therefore we shouldn't assume that `multilib.yaml` was used to initialize the multilib because that could be misleading.
```suggestion
```

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


More information about the cfe-commits mailing list