[PATCH] D134454: [Driver][Distro] Fix ArchLinux triplet and sysroot detection
Adrian Ratiu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 26 02:57:22 PDT 2022
10ne1 added inline comments.
================
Comment at: clang/lib/Driver/ToolChains/Linux.cpp:377-394
+ if (Distro.IsArchLinux()) {
+ std::string Path = (InstallDir + "/../../../../" + TripleStr).str();
+ if (getVFS().exists(Path))
+ return Path;
+ }
+
if (!GCCInstallation.isValid() || !getTriple().isMIPS())
----------------
nickdesaulniers wrote:
> Do we need the Arch-linux test before the call to `GCCInstallation.isValid()`? Otherwise it seems like this duplicates a fair amount of code computing the `Path`. The initial parts of the Path seem to match; there's only more to it if the Distro is not arch-linux.
In my testing on ArchLinux, `GCCInstallation.isValid()` is always `true`.
The problem is that if test condition doesn't just test for a valid GCC install, it also tests `getTriple().isMIPS()` which is always false on Arch Linux which does not support mips, so the sysroot will always be an empty string.
If you wish I can create a separate commit / review to untangle `if (!GCCInstallation.isValid() || !getTriple().isMIPS())` and try to reduce the code duplication, because really having a valid GCC install is independent from running on mips. What do you think?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D134454/new/
https://reviews.llvm.org/D134454
More information about the cfe-commits
mailing list