[clang] 8eb0945 - [Clang][AArch64] NFC: Simplify checkArmStreamingBuiltin.

Sander de Smalen via cfe-commits cfe-commits at lists.llvm.org
Thu May 30 03:32:59 PDT 2024


Author: Sander de Smalen
Date: 2024-05-30T10:26:14Z
New Revision: 8eb0945373173213e7454a475f6e227da12d6d3a

URL: https://github.com/llvm/llvm-project/commit/8eb0945373173213e7454a475f6e227da12d6d3a
DIFF: https://github.com/llvm/llvm-project/commit/8eb0945373173213e7454a475f6e227da12d6d3a.diff

LOG: [Clang][AArch64] NFC: Simplify checkArmStreamingBuiltin.

Changing this into if -> else if -> else if > else is NFC, because
the values of FnType are mutually exclusive.

Added: 
    

Modified: 
    clang/lib/Sema/SemaChecking.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index c3251f3cc9d81..7ce1486dc5fe0 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -3551,22 +3551,16 @@ static void checkArmStreamingBuiltin(Sema &S, CallExpr *TheCall,
       BuiltinType = ArmStreaming;
   }
 
-  if (FnType == ArmStreaming && BuiltinType == ArmNonStreaming) {
+  if (FnType == ArmStreaming && BuiltinType == ArmNonStreaming)
     S.Diag(TheCall->getBeginLoc(), diag::warn_attribute_arm_sm_incompat_builtin)
         << TheCall->getSourceRange() << "streaming";
-  }
-
-  if (FnType == ArmStreamingCompatible &&
-      BuiltinType != ArmStreamingCompatible) {
-    S.Diag(TheCall->getBeginLoc(), diag::warn_attribute_arm_sm_incompat_builtin)
-        << TheCall->getSourceRange() << "streaming compatible";
-    return;
-  }
-
-  if (FnType == ArmNonStreaming && BuiltinType == ArmStreaming) {
+  else if (FnType == ArmNonStreaming && BuiltinType == ArmStreaming)
     S.Diag(TheCall->getBeginLoc(), diag::warn_attribute_arm_sm_incompat_builtin)
         << TheCall->getSourceRange() << "non-streaming";
-  }
+  else if (FnType == ArmStreamingCompatible &&
+           BuiltinType != ArmStreamingCompatible)
+    S.Diag(TheCall->getBeginLoc(), diag::warn_attribute_arm_sm_incompat_builtin)
+        << TheCall->getSourceRange() << "streaming compatible";
 }
 
 static bool hasArmZAState(const FunctionDecl *FD) {


        


More information about the cfe-commits mailing list