[PATCH] D103565: Fix "control reaches end of non-void function" warnings on ppc64le

Zhaomo Yang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 2 15:52:17 PDT 2021


zhaomo created this revision.
zhaomo added reviewers: ymandel, hokein.
Herald added a subscriber: shchenz.
zhaomo requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D103565

Files:
  clang/lib/ASTMatchers/GtestMatchers.cpp


Index: clang/lib/ASTMatchers/GtestMatchers.cpp
===================================================================
--- clang/lib/ASTMatchers/GtestMatchers.cpp
+++ clang/lib/ASTMatchers/GtestMatchers.cpp
@@ -53,6 +53,7 @@
   case GtestCmp::Lt:
     return functionDecl(hasName("::testing::internal::CmpHelperLT"));
   }
+  llvm_unreachable("Unhandled GtestCmp enum");
 }
 
 static llvm::StringRef getMacroTypeName(MacroType Macro) {
@@ -64,6 +65,7 @@
   case MacroType::On:
     return "ON";
   }
+  llvm_unreachable("Unhandled MacroType enum");
 }
 
 static llvm::StringRef getComparisonTypeName(GtestCmp Cmp) {
@@ -81,6 +83,7 @@
   case GtestCmp::Lt:
     return "LT";
   }
+  llvm_unreachable("Unhandled GtestCmp enum");
 }
 
 static std::string getMacroName(MacroType Macro, GtestCmp Cmp) {
@@ -101,9 +104,8 @@
     return "InternalDefaultActionSetAt";
   case MacroType::Expect:
     return "InternalExpectedAt";
-  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 +172,7 @@
             hasOverloadedOperatorName("()"), argumentCountIs(3),
             hasArgument(0, ignoringImplicit(MockCall))))));
   }
+  llvm_unreachable("Unhandled MockArgs enum");
 }
 
 static internal::BindableMatcher<Stmt>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103565.349407.patch
Type: text/x-patch
Size: 1359 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210602/bc8d9d44/attachment-0001.bin>


More information about the cfe-commits mailing list