From: Douglas Gregor Date: Thu, 12 Mar 2009 22:51:37 +0000 (+0000) Subject: Eliminate some unused default cases in switches on the binary operator kind X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=baf534875ed0a55c6342636ff3f4602b8ac22b69;p=clang Eliminate some unused default cases in switches on the binary operator kind git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66837 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index 3d2132a43f..bd6bd298e9 100644 --- a/lib/AST/Expr.cpp +++ b/lib/AST/Expr.cpp @@ -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, diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 2ce7499b25..64a45182f2 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -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;