[clang] [llvm] Add clang driver changes to support MTI RISC-V (PR #134065)

via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 2 03:51:35 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions cpp -- clang/lib/Driver/ToolChains/Arch/RISCV.cpp clang/lib/Driver/ToolChains/Gnu.cpp clang/lib/Driver/ToolChains/Linux.cpp clang/lib/Driver/ToolChains/RISCVToolchain.cpp llvm/lib/Target/RISCV/RISCVSubtarget.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
index e85f014bf..5a9e66e97 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -1907,7 +1907,7 @@ static void findRISCVMultilibs(const Driver &D,
 
   MultilibSet RISCVMultilibs =
       MultilibSetBuilder()
-         .Either(Endian)
+          .Either(Endian)
           .Either({Ilp32, Ilp32f, Ilp32d, Lp64, Lp64f, Lp64d})
           .makeMultilibSet()
           .FilterOut(NonExistent);
@@ -2550,9 +2550,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
   static const char *const RISCV32Triples[] = {"riscv32-unknown-linux-gnu",
                                                "riscv32-unknown-elf"};
   static const char *const RISCV64LibDirs[] = {"/lib64", "/lib"};
-  static const char *const RISCV64Triples[] = {"riscv64-unknown-linux-gnu",
-                                               "riscv64-unknown-elf",
-                                               "riscv64-mti-elf"};
+  static const char *const RISCV64Triples[] = {
+      "riscv64-unknown-linux-gnu", "riscv64-unknown-elf", "riscv64-mti-elf"};
 
   static const char *const SPARCv8LibDirs[] = {"/lib32", "/lib"};
   static const char *const SPARCv8Triples[] = {"sparc-linux-gnu",
diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
index 5d41510bf..4622acf2c 100644
--- a/clang/lib/Driver/ToolChains/Linux.cpp
+++ b/clang/lib/Driver/ToolChains/Linux.cpp
@@ -283,8 +283,9 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
   const bool IsHexagon = Arch == llvm::Triple::hexagon;
   const bool IsRISCV = Triple.isRISCV();
   const bool IsCSKY = Triple.isCSKY();
-  const bool IsMipsSysRoot = IsMips ||
-    (IsRISCV && Triple.getVendor() == llvm::Triple::MipsTechnologies);
+  const bool IsMipsSysRoot =
+      IsMips ||
+      (IsRISCV && Triple.getVendor() == llvm::Triple::MipsTechnologies);
 
   if (IsCSKY && !SelectedMultilibs.empty())
     SysRoot = SysRoot + SelectedMultilibs.back().osSuffix();
@@ -416,9 +417,10 @@ std::string Linux::computeSysRoot() const {
     return std::string();
   }
 
-  const bool IsMipsSysRoot = getTriple().isMIPS() ||
-    (getTriple().isRISCV() &&
-     getTriple().getVendor() == llvm::Triple::MipsTechnologies);
+  const bool IsMipsSysRoot =
+      getTriple().isMIPS() ||
+      (getTriple().isRISCV() &&
+       getTriple().getVendor() == llvm::Triple::MipsTechnologies);
 
   if (!GCCInstallation.isValid() || !IsMipsSysRoot)
     return std::string();

``````````

</details>


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


More information about the llvm-commits mailing list