[clang] [Clang] Enable multilib library support for Linux/Windows (PR #188584)
Petr Hosek via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 8 00:50:01 PDT 2026
================
@@ -767,6 +770,18 @@ void Linux::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
if (std::optional<std::string> Path = getStdlibIncludePath())
addSystemInclude(DriverArgs, CC1Args, *Path);
+ // Add multilib variant include paths in priority order.
+ for (const Multilib &M : getOrderedMultilibs()) {
+ if (M.isDefault())
+ continue;
+ if (std::optional<std::string> StdlibIncDir = getStdlibIncludePath()) {
+ SmallString<128> Dir(*StdlibIncDir);
+ llvm::sys::path::append(Dir, M.includeSuffix());
+ if (D.getVFS().exists(Dir))
+ addSystemInclude(DriverArgs, CC1Args, Dir);
+ }
+ }
----------------
petrhosek wrote:
We usually put the multilib directories first so they take the precedence over the generic ones.
```suggestion
// Add multilib variant include paths in priority order.
for (const Multilib &M : getOrderedMultilibs()) {
if (M.isDefault())
continue;
if (std::optional<std::string> StdlibIncDir = getStdlibIncludePath()) {
SmallString<128> Dir(*StdlibIncDir);
llvm::sys::path::append(Dir, M.includeSuffix());
if (D.getVFS().exists(Dir))
addSystemInclude(DriverArgs, CC1Args, Dir);
}
}
if (std::optional<std::string> Path = getStdlibIncludePath())
addSystemInclude(DriverArgs, CC1Args, *Path);
```
https://github.com/llvm/llvm-project/pull/188584
More information about the cfe-commits
mailing list