[clang] [Driver] Check the environment version except wasm case. (PR #80783)

via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 5 18:06:16 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: None (ZijunZhaoCCK)

<details>
<summary>Changes</summary>

Add isWasm() check for here: https://github.com/llvm/llvm-project/pull/78655#issuecomment-1928075569

---
Full diff: https://github.com/llvm/llvm-project/pull/80783.diff


1 Files Affected:

- (modified) clang/lib/Driver/Driver.cpp (+12-10) 


``````````diff
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 29db9543f3655..04d02ea500d19 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -1443,16 +1443,18 @@ Compilation *Driver::BuildCompilation(ArrayRef<const char *> ArgList) {
   const ToolChain &TC = getToolChain(
       *UArgs, computeTargetTriple(*this, TargetTriple, *UArgs));
 
-  // Check if the environment version is valid.
-  llvm::Triple Triple = TC.getTriple();
-  StringRef TripleVersionName = Triple.getEnvironmentVersionString();
-  StringRef TripleObjectFormat =
-      Triple.getObjectFormatTypeName(Triple.getObjectFormat());
-  if (Triple.getEnvironmentVersion().empty() && TripleVersionName != "" &&
-      TripleVersionName != TripleObjectFormat) {
-    Diags.Report(diag::err_drv_triple_version_invalid)
-        << TripleVersionName << TC.getTripleString();
-    ContainsError = true;
+  // Check if the environment version is valid except wasm case.
+  if (!TC.getTriple().isWasm()) {
+    llvm::Triple Triple = TC.getTriple();
+    StringRef TripleVersionName = Triple.getEnvironmentVersionString();
+    StringRef TripleObjectFormat =
+        Triple.getObjectFormatTypeName(Triple.getObjectFormat());
+    if (Triple.getEnvironmentVersion().empty() && TripleVersionName != "" &&
+        TripleVersionName != TripleObjectFormat) {
+      Diags.Report(diag::err_drv_triple_version_invalid)
+          << TripleVersionName << TC.getTripleString();
+      ContainsError = true;
+    }
   }
 
   // Report warning when arm64EC option is overridden by specified target

``````````

</details>


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


More information about the cfe-commits mailing list