[clang] [clang][Sema][NFC] remove unreachable return statement (PR #100642)

Mike Rice via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 25 12:34:57 PDT 2024


https://github.com/mikerice1969 created https://github.com/llvm/llvm-project/pull/100642

The switch now returns in every case so the end return is unreachable.

>From 8804f18fcaf1a70bad10a8e66414f91556df23bd Mon Sep 17 00:00:00 2001
From: Mike Rice <michael.p.rice at intel.com>
Date: Thu, 25 Jul 2024 11:35:11 -0700
Subject: [PATCH] [clang][Sema][NFC] remove unreachable return statement

The switch now returns in every case so the end return is unreachable.
---
 clang/lib/Sema/SemaPPC.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/clang/lib/Sema/SemaPPC.cpp b/clang/lib/Sema/SemaPPC.cpp
index 99f46b12e6968..5b764ed396ebc 100644
--- a/clang/lib/Sema/SemaPPC.cpp
+++ b/clang/lib/Sema/SemaPPC.cpp
@@ -93,7 +93,6 @@ bool SemaPPC::CheckPPCBuiltinFunctionCall(const TargetInfo &TI,
                                           unsigned BuiltinID,
                                           CallExpr *TheCall) {
   ASTContext &Context = getASTContext();
-  unsigned i = 0, l = 0, u = 0;
   bool IsTarget64Bit = TI.getTypeWidth(TI.getIntPtrType()) == 64;
   llvm::APSInt Result;
 
@@ -248,7 +247,7 @@ bool SemaPPC::CheckPPCBuiltinFunctionCall(const TargetInfo &TI,
     return BuiltinPPCMMACall(TheCall, BuiltinID, Types);
 #include "clang/Basic/BuiltinsPPC.def"
   }
-  return SemaRef.BuiltinConstantArgRange(TheCall, i, l, u);
+  llvm_unreachable("must return from switch");
 }
 
 // Check if the given type is a non-pointer PPC MMA type. This function is used



More information about the cfe-commits mailing list