Skip to content

Commit 073ab2c

Browse files
committed
Simplify code and test
1 parent 7c83997 commit 073ab2c

File tree

2 files changed

+9
-16
lines changed

2 files changed

+9
-16
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2556,7 +2556,7 @@ static void CollectArgsForIntegratedAssembler(Compilation &C,
25562556
bool Crel = false, ExperimentalCrel = false;
25572557
bool UseRelaxRelocations = C.getDefaultToolChain().useRelaxRelocations();
25582558
bool UseNoExecStack = false;
2559-
std::optional<bool> Msa;
2559+
bool Msa = false;
25602560
const char *MipsTargetFeature = nullptr;
25612561
StringRef ImplicitIt;
25622562
for (const Arg *A :
@@ -2786,7 +2786,7 @@ static void CollectArgsForIntegratedAssembler(Compilation &C,
27862786
<< "-Wa,--crel" << D.getTargetTriple();
27872787
}
27882788
}
2789-
if (Msa && *Msa)
2789+
if (Msa)
27902790
CmdArgs.push_back("-mmsa");
27912791
if (!UseRelaxRelocations)
27922792
CmdArgs.push_back("-mrelax-relocations=no");

clang/test/Driver/mips-msa.c

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
11
// RUN: %clang -### -c --target=mips64el-unknown-linux-gnuabi64 \
2-
// RUN: -Wa,-mmsa %s -Werror 2>&1 | FileCheck %s --check-prefix=CHECK-MMSA
2+
// RUN: -Wa,-mmsa %s -Werror 2>&1 | FileCheck %s --check-prefix=CHECK-MMSA
33
// CHECK-MMSA: "-cc1" {{.*}}"-mmsa"
44

55
// RUN: %clang -### -c --target=mips64el-unknown-linux-gnuabi64 \
6-
// RUN: -Wa,-mno-msa,-mmsa %s -Werror 2>&1 | FileCheck %s --check-prefix=CHECK-MMSA
6+
// RUN: -Wa,-mmsa,-mno-msa %s -Werror 2>&1 | FileCheck %s --check-prefix=CHECK-NOMMSA
7+
// CHECK-NOMMSA: "-cc1"
8+
// CHECK-NOMMSA-NOT: "-mssa"
79

8-
// RUN: %clang -### -c --target=mips64el-unknown-linux-gnuabi64 \
9-
// RUN: -Wa,-mmsa,-mno-msa %s -Werror 2>&1 | FileCheck %s --check-prefix=CHECK-NOMMSA
10-
// CHECK-NOMMSA: "-cc1"
11-
12-
// RUN: %clang -### -c --target=mips64el-unknown-linux-gnuabi64 \
13-
// RUN: -fno-integrated-as -Wa,-mmsa %s -Werror 2>&1 | FileCheck %s --check-prefix=MIPS-MSA
14-
// MIPS-MSA: as{{(.exe)?}}" "-march" "mips64r2" "-mabi" "64" "-EL" "-KPIC" "-mmsa"
15-
16-
// RUN: %clang -### -c --target=mips64el-unknown-linux-gnuabi64 \
17-
// RUN: -fno-integrated-as -Wa,-mno-msa %s -Werror 2>&1 | FileCheck %s --check-prefix=MIPS-NOMSA
18-
// MIPS-NOMSA: as{{(.exe)?}}"
19-
// MIPS-NOMSA-NOT: "-mmsa"
10+
// RUN: not %clang -### -c --target=x86_64 -Wa,-mmsa -Wa,-mno-msa %s 2>&1 | FileCheck %s --check-prefix=ERR
11+
// ERR: error: unsupported argument '-mmsa' to option '-Wa,'
12+
// ERR: error: unsupported argument '-mno-msa' to option '-Wa,'

0 commit comments

Comments
 (0)