================ @@ -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) { + if (!getASTContext().getTargetInfo().hasFeature("fmv")) + return true; + + assert(Strs.size() == Locs.size() && + "Mismatch between number of strings and locations"); + + bool HasDefault = false; + bool HasNonDefault = false; + for (unsigned I = 0; I < Strs.size(); ++I) { + StringRef Str = Strs[I].trim(); ---------------- tmatheson-arm wrote:
What is `Str`? Is it an individual parameter of the `target_clones` attribute? Maybe something like `Param` would be a better name. https://github.com/llvm/llvm-project/pull/149067 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits