[clang] [TargetVersion] Only enable on RISC-V and AArch64 (PR #115991)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 14 04:23:41 PST 2024
================
@@ -3040,6 +3040,11 @@ bool Sema::checkTargetVersionAttr(SourceLocation LiteralLoc, Decl *D,
enum FirstParam { Unsupported };
enum SecondParam { None };
enum ThirdParam { Target, TargetClones, TargetVersion };
+
+ if (!Context.getTargetInfo().getTriple().isRISCV() &&
+ !Context.getTargetInfo().getTriple().isAArch64())
+ return Diag(LiteralLoc, diag::err_target_version_unsupported);
----------------
AaronBallman wrote:
A better way to handle this is to use `TargetSpecificAttr` for `TargetVersion` in `Attr.td` (instead of `InheritableAttr`). That should automatically handle performing this check and you won't need to add a custom diagnostic.
https://github.com/llvm/llvm-project/pull/115991
More information about the cfe-commits
mailing list