mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-19 01:46:49 +00:00
[Driver] Report invalid target triple versions for all environment types. (#78655)
Followup for https://github.com/llvm/llvm-project/pull/75373 1. Make this feature not just available for android, but everyone. 2. Correct some target triples. 3. Add opencl to the environment type list.
This commit is contained in:
parent
6590d0fed5
commit
34c4a0fa2b
@ -5,7 +5,7 @@
|
||||
// RUN: %check_clang_tidy %s bugprone-implicit-widening-of-multiplication-result %t -- -- -target x86_64-unknown-unknown -x c++ -fsigned-char
|
||||
|
||||
// RUN: %check_clang_tidy -std=c99 %s bugprone-implicit-widening-of-multiplication-result %t -- -- -target x86_64-unknown-unknown -x c -funsigned-char
|
||||
// RUN: %check_clang_tidy %s bugprone-implicit-widening-of-multiplication-result %t -- -- -target x86_64-unknown-unknown-x c++ -funsigned-char
|
||||
// RUN: %check_clang_tidy %s bugprone-implicit-widening-of-multiplication-result %t -- -- -target x86_64 c++ -funsigned-char
|
||||
|
||||
long t0(char a, char b) {
|
||||
return a * b;
|
||||
|
@ -1443,15 +1443,16 @@ Compilation *Driver::BuildCompilation(ArrayRef<const char *> ArgList) {
|
||||
const ToolChain &TC = getToolChain(
|
||||
*UArgs, computeTargetTriple(*this, TargetTriple, *UArgs));
|
||||
|
||||
if (TC.getTriple().isAndroid()) {
|
||||
llvm::Triple Triple = TC.getTriple();
|
||||
StringRef TripleVersionName = Triple.getEnvironmentVersionString();
|
||||
|
||||
if (Triple.getEnvironmentVersion().empty() && TripleVersionName != "") {
|
||||
Diags.Report(diag::err_drv_triple_version_invalid)
|
||||
<< TripleVersionName << TC.getTripleString();
|
||||
ContainsError = true;
|
||||
}
|
||||
// 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;
|
||||
}
|
||||
|
||||
// Report warning when arm64EC option is overridden by specified target
|
||||
|
@ -1,4 +1,4 @@
|
||||
// RUN: %clang -target aarch64-linux-gnuabi %s -S -emit-llvm -o - | FileCheck %s
|
||||
// RUN: %clang -target aarch64-linux-gnueabi %s -S -emit-llvm -o - | FileCheck %s
|
||||
|
||||
_Complex long double a, b, c, d;
|
||||
void test_fp128_compound_assign(void) {
|
||||
|
@ -400,12 +400,12 @@
|
||||
// LONG-CALLS-DEF-NOT: "long-calls"
|
||||
//
|
||||
// -mbranch-likely
|
||||
// RUN: %clang -target -mips-mti-linux-gnu -### -c %s -mbranch-likely 2>&1 \
|
||||
// RUN: %clang --target=mips-mti-linux-gnu -### -c %s -mbranch-likely 2>&1 \
|
||||
// RUN: | FileCheck --check-prefix=BRANCH-LIKELY %s
|
||||
// BRANCH-LIKELY: argument unused during compilation: '-mbranch-likely'
|
||||
//
|
||||
// -mno-branch-likely
|
||||
// RUN: %clang -target -mips-mti-linux-gnu -### -c %s -mno-branch-likely 2>&1 \
|
||||
// RUN: %clang --target=mips-mti-linux-gnu -### -c %s -mno-branch-likely 2>&1 \
|
||||
// RUN: | FileCheck --check-prefix=NO-BRANCH-LIKELY %s
|
||||
// NO-BRANCH-LIKELY: argument unused during compilation: '-mno-branch-likely'
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
// RUN: %clang -x c -ffixed-point -S -emit-llvm -o - %s | FileCheck %s
|
||||
// RUN: %clang -x c -ffixed-point -S -emit-llvm -o - --target=x86_64-scei-ps4-ubuntu-fast %s | FileCheck %s
|
||||
// RUN: %clang -x c -ffixed-point -S -emit-llvm -o - --target=x86_64-scei-ps4 %s | FileCheck %s
|
||||
// RUN: %clang -x c -ffixed-point -S -emit-llvm -o - --target=ppc64 %s | FileCheck %s
|
||||
// RUN: %clang -x c -ffixed-point -S -emit-llvm -o - --target=x86_64-scei-ps4-windows10pro-fast %s | FileCheck %s
|
||||
// RUN: %clang -x c -ffixed-point -S -emit-llvm -o - --target=x86_64-scei-ps4 %s | FileCheck %s
|
||||
|
||||
/* Primary signed _Accum */
|
||||
|
||||
|
@ -276,7 +276,7 @@ public:
|
||||
Callable,
|
||||
Mesh,
|
||||
Amplification,
|
||||
|
||||
OpenCL,
|
||||
OpenHOS,
|
||||
|
||||
LastEnvironmentType = OpenHOS
|
||||
|
@ -323,6 +323,8 @@ StringRef Triple::getEnvironmentTypeName(EnvironmentType Kind) {
|
||||
case Callable: return "callable";
|
||||
case Mesh: return "mesh";
|
||||
case Amplification: return "amplification";
|
||||
case OpenCL:
|
||||
return "opencl";
|
||||
case OpenHOS: return "ohos";
|
||||
}
|
||||
|
||||
@ -692,6 +694,7 @@ static Triple::EnvironmentType parseEnvironment(StringRef EnvironmentName) {
|
||||
.StartsWith("callable", Triple::Callable)
|
||||
.StartsWith("mesh", Triple::Mesh)
|
||||
.StartsWith("amplification", Triple::Amplification)
|
||||
.StartsWith("opencl", Triple::OpenCL)
|
||||
.StartsWith("ohos", Triple::OpenHOS)
|
||||
.Default(Triple::UnknownEnvironment);
|
||||
}
|
||||
@ -1219,8 +1222,24 @@ VersionTuple Triple::getEnvironmentVersion() const {
|
||||
|
||||
StringRef Triple::getEnvironmentVersionString() const {
|
||||
StringRef EnvironmentName = getEnvironmentName();
|
||||
|
||||
// none is a valid environment type - it basically amounts to a freestanding
|
||||
// environment.
|
||||
if (EnvironmentName == "none")
|
||||
return "";
|
||||
|
||||
StringRef EnvironmentTypeName = getEnvironmentTypeName(getEnvironment());
|
||||
EnvironmentName.consume_front(EnvironmentTypeName);
|
||||
|
||||
if (EnvironmentName.contains("-")) {
|
||||
// -obj is the suffix
|
||||
if (getObjectFormat() != Triple::UnknownObjectFormat) {
|
||||
StringRef ObjectFormatTypeName =
|
||||
getObjectFormatTypeName(getObjectFormat());
|
||||
const std::string tmp = (Twine("-") + ObjectFormatTypeName).str();
|
||||
EnvironmentName.consume_back(tmp);
|
||||
}
|
||||
}
|
||||
return EnvironmentName;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user