File tree 2 files changed +26
-9
lines changed 2 files changed +26
-9
lines changed Original file line number Diff line number Diff line change @@ -1443,16 +1443,18 @@ Compilation *Driver::BuildCompilation(ArrayRef<const char *> ArgList) {
1443
1443
const ToolChain &TC = getToolChain (
1444
1444
*UArgs, computeTargetTriple (*this , TargetTriple, *UArgs));
1445
1445
1446
- // Check if the environment version is valid.
1446
+ // Check if the environment version is valid except wasm case .
1447
1447
llvm::Triple Triple = TC.getTriple ();
1448
- StringRef TripleVersionName = Triple.getEnvironmentVersionString ();
1449
- StringRef TripleObjectFormat =
1450
- Triple.getObjectFormatTypeName (Triple.getObjectFormat ());
1451
- if (Triple.getEnvironmentVersion ().empty () && TripleVersionName != " " &&
1452
- TripleVersionName != TripleObjectFormat) {
1453
- Diags.Report (diag::err_drv_triple_version_invalid)
1454
- << TripleVersionName << TC.getTripleString ();
1455
- ContainsError = true ;
1448
+ if (!Triple.isWasm ()) {
1449
+ StringRef TripleVersionName = Triple.getEnvironmentVersionString ();
1450
+ StringRef TripleObjectFormat =
1451
+ Triple.getObjectFormatTypeName (Triple.getObjectFormat ());
1452
+ if (Triple.getEnvironmentVersion ().empty () && TripleVersionName != " " &&
1453
+ TripleVersionName != TripleObjectFormat) {
1454
+ Diags.Report (diag::err_drv_triple_version_invalid)
1455
+ << TripleVersionName << TC.getTripleString ();
1456
+ ContainsError = true ;
1457
+ }
1456
1458
}
1457
1459
1458
1460
// Report warning when arm64EC option is overridden by specified target
Original file line number Diff line number Diff line change 14
14
// RUN: FileCheck --check-prefix=CHECK-TARGET %s
15
15
16
16
// CHECK-TARGET: "aarch64-unknown-linux-android31"
17
+
18
+ // RUN: not %clang --target=armv7-linux-gnuS -c %s -### 2>&1 | \
19
+ // RUN: FileCheck --check-prefix=CHECK-ERROR2 %s
20
+
21
+ // CHECK-ERROR2: error: version 'S' in target triple 'armv7-unknown-linux-gnuS' is invalid
22
+
23
+ // RUN: %clang --target=wasm32-unknown-wasi-preview2 -c %s -### 2>&1 | \
24
+ // RUN: FileCheck --check-prefix=CHECK-WASM %s
25
+
26
+ // CHECK-WASM: "-triple" "wasm32-unknown-wasi-preview2"
27
+
28
+ // RUN: %clang --target=wasm32-wasi-pthread -c %s -### 2>&1 | \
29
+ // RUN: FileCheck --check-prefix=CHECK-WASM1 %s
30
+
31
+ // CHECK-WASM1: "-triple" "wasm32-unknown-wasi-pthread"
You can’t perform that action at this time.
0 commit comments