]> granicus.if.org Git - clang/commitdiff
Eliminate some unused default cases in switches on the binary operator kind
authorDouglas Gregor <dgregor@apple.com>
Thu, 12 Mar 2009 22:51:37 +0000 (22:51 +0000)
committerDouglas Gregor <dgregor@apple.com>
Thu, 12 Mar 2009 22:51:37 +0000 (22:51 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66837 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/Expr.cpp
lib/Sema/SemaExpr.cpp

index 3d2132a43fa7a43e39ea4f26a9cc4ae25d4045fe..bd6bd298e9ed364ce7147b1b9dec6ae186c5ad62 100644 (file)
@@ -190,7 +190,8 @@ unsigned CallExpr::isBuiltinCall(ASTContext &Context) const {
 /// corresponds to, e.g. "<<=".
 const char *BinaryOperator::getOpcodeStr(Opcode Op) {
   switch (Op) {
-  default: assert(0 && "Unknown binary operator");
+  case PtrMemD:   return ".*";
+  case PtrMemI:   return "->*";
   case Mul:       return "*";
   case Div:       return "/";
   case Rem:       return "%";
@@ -222,6 +223,8 @@ const char *BinaryOperator::getOpcodeStr(Opcode Op) {
   case OrAssign:  return "|=";
   case Comma:     return ",";
   }
+
+  return "";
 }
 
 InitListExpr::InitListExpr(SourceLocation lbraceloc, 
index 2ce7499b25af9e6547ccde4ce18d82066b3130c5..64a45182f2a35d198542cdb5fab34e1e39a4fffc 100644 (file)
@@ -3886,8 +3886,6 @@ Action::OwningExprResult Sema::CreateBuiltinBinOp(SourceLocation OpLoc,
   BinaryOperator::Opcode Opc = (BinaryOperator::Opcode)Op;
 
   switch (Opc) {
-  default:
-    assert(0 && "Unknown binary expr!");
   case BinaryOperator::Assign:
     ResultTy = CheckAssignmentOperands(lhs, rhs, OpLoc, QualType());
     break;