[clang] b2c8bcb - Fix "control reaches end of non-void function" warnings on ppc64le

Yitzhak Mandelbaum via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 2 17:54:21 PDT 2021


Author: Zhaomo Yang
Date: 2021-06-03T00:53:53Z
New Revision: b2c8bcbab8a44c4582632845697b9425c3200230

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

LOG: Fix "control reaches end of non-void function" warnings on ppc64le

Warnings can be found here: https://lab.llvm.org/buildbot/#/builders/76/builds/2640

Reviewed By: ymandel

Differential Revision: https://reviews.llvm.org/D103565

Added: 
    

Modified: 
    clang/lib/ASTMatchers/GtestMatchers.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/ASTMatchers/GtestMatchers.cpp b/clang/lib/ASTMatchers/GtestMatchers.cpp
index 79f69c63c10f0..6e4c12f319692 100644
--- a/clang/lib/ASTMatchers/GtestMatchers.cpp
+++ b/clang/lib/ASTMatchers/GtestMatchers.cpp
@@ -53,6 +53,7 @@ static DeclarationMatcher getComparisonDecl(GtestCmp Cmp) {
   case GtestCmp::Lt:
     return functionDecl(hasName("::testing::internal::CmpHelperLT"));
   }
+  llvm_unreachable("Unhandled GtestCmp enum");
 }
 
 static llvm::StringRef getMacroTypeName(MacroType Macro) {
@@ -64,6 +65,7 @@ static llvm::StringRef getMacroTypeName(MacroType Macro) {
   case MacroType::On:
     return "ON";
   }
+  llvm_unreachable("Unhandled MacroType enum");
 }
 
 static llvm::StringRef getComparisonTypeName(GtestCmp Cmp) {
@@ -81,6 +83,7 @@ static llvm::StringRef getComparisonTypeName(GtestCmp Cmp) {
   case GtestCmp::Lt:
     return "LT";
   }
+  llvm_unreachable("Unhandled GtestCmp enum");
 }
 
 static std::string getMacroName(MacroType Macro, GtestCmp Cmp) {
@@ -104,6 +107,7 @@ static llvm::StringRef getSpecSetterName(MacroType Macro) {
   default:
     llvm_unreachable("Unhandled MacroType enum");
   }
+  llvm_unreachable("Unhandled MacroType enum");
 }
 
 // In general, AST matchers cannot match calls to macros. However, we can
@@ -170,6 +174,7 @@ gtestCallInternal(MacroType Macro, StatementMatcher MockCall, MockArgs Args) {
             hasOverloadedOperatorName("()"), argumentCountIs(3),
             hasArgument(0, ignoringImplicit(MockCall))))));
   }
+  llvm_unreachable("Unhandled MockArgs enum");
 }
 
 static internal::BindableMatcher<Stmt>


        


More information about the cfe-commits mailing list