[clang] [RFC] [clang][Toolchain] Treat "pc"/"unknown" vendor interchangeable (PR #97802)

via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 5 02:31:30 PDT 2024


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 687531fbed080b86c31144bf66c29f4a30e10e84 dd290ddc48fd60d29e2c0eb839f9e9a08746d5f2 -- clang/test/Driver/pc-unknown-toolchain.c clang/lib/Driver/ToolChain.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index 716cbfb432..43ec3c234b 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -766,24 +766,23 @@ ToolChain::getTargetSubDirPath(StringRef BaseDir) const {
     return *Path;
 
   // Treat "pc" and "unknown" vendors interchangeable
-  switch (getTriple().getVendor())
-  {
-    case Triple::UnknownVendor: {
-      llvm::Triple TripleFallback = Triple;
-      TripleFallback.setVendor(Triple::PC);
-      if (auto Path = getPathForTriple(TripleFallback))
-        return *Path;
-      break;
-    }
-    case Triple::PC: {
-      llvm::Triple TripleFallback = Triple;
-      TripleFallback.setVendor(Triple::UnknownVendor);
-      if (auto Path = getPathForTriple(TripleFallback))
-        return *Path;
-      break;
-    }
-    default:
-      break;
+  switch (getTriple().getVendor()) {
+  case Triple::UnknownVendor: {
+    llvm::Triple TripleFallback = Triple;
+    TripleFallback.setVendor(Triple::PC);
+    if (auto Path = getPathForTriple(TripleFallback))
+      return *Path;
+    break;
+  }
+  case Triple::PC: {
+    llvm::Triple TripleFallback = Triple;
+    TripleFallback.setVendor(Triple::UnknownVendor);
+    if (auto Path = getPathForTriple(TripleFallback))
+      return *Path;
+    break;
+  }
+  default:
+    break;
   }
 
   // When building with per target runtime directories, various ways of naming

``````````

</details>


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


More information about the cfe-commits mailing list