aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/SemaChecking.cpp
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@sifive.com>2023-12-27 23:44:45 -0800
committerGitHub <noreply@github.com>2023-12-27 23:44:45 -0800
commit471f8f50d0790cd7e77b8b385d8592c95df53974 (patch)
tree380cc19e7561c7c817cec43642c787161770fdda /clang/lib/Sema/SemaChecking.cpp
parent3e75dece919511e4a2edada82d783304cc14a9cd (diff)
downloadllvm-471f8f50d0790cd7e77b8b385d8592c95df53974.zip
llvm-471f8f50d0790cd7e77b8b385d8592c95df53974.tar.gz
llvm-471f8f50d0790cd7e77b8b385d8592c95df53974.tar.bz2
[RISCV] Prevent checkRVVTypeSupport from issuing more than 1 diagnostic. (#74950)
If vector isn't enabled at all, we might hit one of the earlier diagnostics and the requires Zve32x diagnostic. The Zve32x diagnostic would be redundant.
Diffstat (limited to 'clang/lib/Sema/SemaChecking.cpp')
-rw-r--r--clang/lib/Sema/SemaChecking.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 27079ef..2e61daf 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -6181,22 +6181,22 @@ void Sema::checkRVVTypeSupport(QualType Ty, SourceLocation Loc, Decl *D) {
if (((EltSize == 64 && Info.ElementType->isIntegerType()) || MinElts == 1) &&
!TI.hasFeature("zve64x"))
Diag(Loc, diag::err_riscv_type_requires_extension, D) << Ty << "zve64x";
- if (Info.ElementType->isFloat16Type() && !TI.hasFeature("zvfh") &&
- !TI.hasFeature("zvfhmin"))
+ else if (Info.ElementType->isFloat16Type() && !TI.hasFeature("zvfh") &&
+ !TI.hasFeature("zvfhmin"))
Diag(Loc, diag::err_riscv_type_requires_extension, D)
<< Ty << "zvfh or zvfhmin";
- if (Info.ElementType->isBFloat16Type() &&
- !TI.hasFeature("experimental-zvfbfmin"))
+ else if (Info.ElementType->isBFloat16Type() &&
+ !TI.hasFeature("experimental-zvfbfmin"))
Diag(Loc, diag::err_riscv_type_requires_extension, D) << Ty << "zvfbfmin";
- if (Info.ElementType->isSpecificBuiltinType(BuiltinType::Float) &&
- !TI.hasFeature("zve32f"))
+ else if (Info.ElementType->isSpecificBuiltinType(BuiltinType::Float) &&
+ !TI.hasFeature("zve32f"))
Diag(Loc, diag::err_riscv_type_requires_extension, D) << Ty << "zve32f";
- if (Info.ElementType->isSpecificBuiltinType(BuiltinType::Double) &&
- !TI.hasFeature("zve64d"))
+ else if (Info.ElementType->isSpecificBuiltinType(BuiltinType::Double) &&
+ !TI.hasFeature("zve64d"))
Diag(Loc, diag::err_riscv_type_requires_extension, D) << Ty << "zve64d";
// Given that caller already checked isRVVType() before calling this function,
// if we don't have at least zve32x supported, then we need to emit error.
- if (!TI.hasFeature("zve32x"))
+ else if (!TI.hasFeature("zve32x"))
Diag(Loc, diag::err_riscv_type_requires_extension, D) << Ty << "zve32x";
}