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

via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 25 12:35:30 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-powerpc

Author: Mike Rice (mikerice1969)

<details>
<summary>Changes</summary>

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

---
Full diff: https://github.com/llvm/llvm-project/pull/100642.diff


1 Files Affected:

- (modified) clang/lib/Sema/SemaPPC.cpp (+1-2) 


``````````diff
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

``````````

</details>


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


More information about the cfe-commits mailing list