[clang] [Clang][AArch64] Warn when calling streaming/non-streaming about vect… (PR #79842)
Sander de Smalen via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 14 00:38:35 PST 2024
================
@@ -12236,6 +12236,23 @@ bool Sema::CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD,
bool UsesSM = NewFD->hasAttr<ArmLocallyStreamingAttr>();
bool UsesZA = Attr && Attr->isNewZA();
bool UsesZT0 = Attr && Attr->isNewZT0();
+
+ if (UsesSM) {
+ if (NewFD->getReturnType()->isSizelessVectorType())
+ Diag(NewFD->getLocation(),
+ diag::warn_sme_locally_streaming_has_vl_args_returns);
+ auto *FPT = NewFD->getType()->castAs<FunctionProtoType>();
+ bool AnyScalableArgs = false;
+ for (QualType T : FPT->param_types()) {
+ if (T->isSizelessVectorType()) {
+ AnyScalableArgs = true;
+ break;
+ }
+ }
+ if (AnyScalableArgs)
+ Diag(NewFD->getLocation(),
+ diag::warn_sme_locally_streaming_has_vl_args_returns);
----------------
sdesmalen-arm wrote:
Can this be written like something along the lines of:
```
if (NewFD->getReturnType()->isSizelessVectorType() ||
llvm::any_of(FPT->param_types(), [](QualType T) { return T->isSizelessVectorType(); }))
Diag(....);
```
?
https://github.com/llvm/llvm-project/pull/79842
More information about the cfe-commits
mailing list