[clang] 254bfe2 - [Clang][AArch64] Expect valid FunctionDecl in IsArmStreamingFunction

Sander de Smalen via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 30 08:05:36 PDT 2025


Author: Sander de Smalen
Date: 2025-07-30T15:04:47Z
New Revision: 254bfe23e3174d5695f4e35212ff352082f05ae4

URL: https://github.com/llvm/llvm-project/commit/254bfe23e3174d5695f4e35212ff352082f05ae4
DIFF: https://github.com/llvm/llvm-project/commit/254bfe23e3174d5695f4e35212ff352082f05ae4.diff

LOG: [Clang][AArch64] Expect valid FunctionDecl in IsArmStreamingFunction

This follows from a conversation on #150592 where we decided to
split out this change and commit it separately.

The rationale is that FunctionDecl must be sufficiently parsed/created
in order to tell whether it is a streaming function.

Added: 
    

Modified: 
    clang/lib/AST/Decl.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index 83fcd87aec2f8..1588be4eff075 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -5988,11 +5988,10 @@ bool clang::IsArmStreamingFunction(const FunctionDecl *FD,
     if (FD->hasAttr<ArmLocallyStreamingAttr>())
       return true;
 
-  if (const Type *Ty = FD->getType().getTypePtrOrNull())
-    if (const auto *FPT = Ty->getAs<FunctionProtoType>())
-      if (FPT->getAArch64SMEAttributes() &
-          FunctionType::SME_PStateSMEnabledMask)
-        return true;
+  assert(!FD->getType().isNull() && "Expected a valid FunctionDecl");
+  if (const auto *FPT = FD->getType()->getAs<FunctionProtoType>())
+    if (FPT->getAArch64SMEAttributes() & FunctionType::SME_PStateSMEnabledMask)
+      return true;
 
   return false;
 }


        


More information about the cfe-commits mailing list