[clang] [NFC][Clang][FMV] Refactor sema checking of target_version/clones attributes. (PR #149067)
Tomas Matheson via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 18 05:27:47 PDT 2025
================
@@ -1535,4 +1535,91 @@ bool SemaARM::areLaxCompatibleSveTypes(QualType FirstType,
IsLaxCompatible(SecondType, FirstType);
}
+enum FirstParam { Unsupported, Duplicate, Unknown };
+enum SecondParam { None, CPU, Tune };
+enum ThirdParam { Target, TargetClones, TargetVersion };
+
+bool SemaARM::checkTargetVersionAttr(StringRef Str, SourceLocation Loc) {
+ llvm::SmallVector<StringRef, 8> Features;
+ Str.split(Features, '+');
+ for (StringRef Feat : Features) {
+ Feat = Feat.trim();
+ if (Feat == "default")
+ continue;
+ if (!getASTContext().getTargetInfo().validateCpuSupports(Feat))
+ return Diag(Loc, diag::warn_unsupported_target_attribute)
+ << Unsupported << None << Feat << TargetVersion;
+ }
+ return false;
+}
+
+bool SemaARM::checkTargetClonesAttr(SmallVectorImpl<StringRef> &Strs,
+ SmallVectorImpl<SourceLocation> &Locs,
+ SmallVectorImpl<SmallString<64>> &Buffer) {
----------------
tmatheson-arm wrote:
Is there a more descriptive name than `Buffer`?
https://github.com/llvm/llvm-project/pull/149067
More information about the cfe-commits
mailing list