[clang] [Clang][RISCV] Recognize unsupport target feature by supporting isValidFeatureName (PR #106495)
Piyou Chen via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 30 00:57:32 PDT 2024
================
@@ -2993,10 +2993,17 @@ bool Sema::checkTargetAttr(SourceLocation LiteralLoc, StringRef AttrStr) {
return Diag(LiteralLoc, diag::warn_unsupported_target_attribute)
<< Unknown << Tune << ParsedAttrs.Tune << Target;
- if (Context.getTargetInfo().getTriple().isRISCV() &&
- ParsedAttrs.Duplicate != "")
- return Diag(LiteralLoc, diag::err_duplicate_target_attribute)
- << Duplicate << None << ParsedAttrs.Duplicate << Target;
+ if (Context.getTargetInfo().getTriple().isRISCV()) {
+ if (ParsedAttrs.Duplicate != "")
+ return Diag(LiteralLoc, diag::err_duplicate_target_attribute)
+ << Duplicate << None << ParsedAttrs.Duplicate << Target;
+ for (const auto &Feature : ParsedAttrs.Features) {
+ auto CurFeature = StringRef(Feature);
+ if (!CurFeature.starts_with("+") && !CurFeature.starts_with("-"))
----------------
BeMg wrote:
Updated.
https://github.com/llvm/llvm-project/pull/106495
More information about the cfe-commits
mailing list