[clang] [AArch64][SME] Warn when using a streaming builtin from a non-streaming function (PR #74064)

Sander de Smalen via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 13 01:43:32 PST 2023


================
@@ -3168,9 +3167,60 @@ static void checkArmStreamingBuiltin(Sema &S, CallExpr *TheCall,
         << TheCall->getSourceRange() << "streaming compatible";
     return;
   }
+
+  if (FnType == ArmNonStreaming && BuiltinType == ArmStreaming) {
+    S.Diag(TheCall->getBeginLoc(), diag::warn_attribute_arm_sm_incompat_builtin)
+        << TheCall->getSourceRange() << "non-streaming";
+  }
+}
+
+bool Sema::CheckSMEBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
+  if (const FunctionDecl *FD = getCurFunctionDecl()) {
+    ArmStreamingType BuiltinType;
+
+    switch (BuiltinID) {
+    default:
+      BuiltinType = ArmNonStreaming;
+      break;
+#define GET_SME_STREAMING_ATTRS
+#include "clang/Basic/arm_sme_streaming_attrs.inc"
+#undef GET_SME_STREAMING_ATTRS
+#define GET_SVE_STREAMING_ATTRS
+#include "clang/Basic/arm_sve_streaming_attrs.inc"
----------------
sdesmalen-arm wrote:

The SVE streaming-mode attributes already checked in `CheckSVEBuiltinFunctionCall`, there is no need to include them here again.

https://github.com/llvm/llvm-project/pull/74064


More information about the cfe-commits mailing list