aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2012-01-16 23:24:27 +0000
committerDavid Blaikie <dblaikie@gmail.com>2012-01-16 23:24:27 +0000
commit2dd674fdce68f8fd59d78a3bbab2cf5b8d220290 (patch)
tree8b7a43bbe2df7368233f7c1c688a09632ba12bbd
parent17d2dbd5f9dd6c0de86398178f302ef46ba6ec79 (diff)
downloadexternal_llvm-2dd674fdce68f8fd59d78a3bbab2cf5b8d220290.zip
external_llvm-2dd674fdce68f8fd59d78a3bbab2cf5b8d220290.tar.gz
external_llvm-2dd674fdce68f8fd59d78a3bbab2cf5b8d220290.tar.bz2
Removing unused default switch cases in switches over enums that already account for all enumeration values explicitly.
(This time I believe I've checked all the -Wreturn-type warnings from GCC & added the couple of llvm_unreachables necessary to silence them. If I've missed any, I'll happily fix them as soon as I know about them) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148262 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp2
-rw-r--r--lib/Support/CommandLine.cpp6
-rw-r--r--lib/Support/SourceMgr.cpp1
-rw-r--r--lib/TableGen/Record.cpp3
-rw-r--r--lib/Target/ARM/ARMConstantPoolValue.cpp2
-rw-r--r--lib/Target/ARM/AsmParser/ARMAsmParser.cpp6
-rw-r--r--lib/Target/Mips/MipsJITInfo.cpp3
-rw-r--r--lib/VMCore/Core.cpp3
-rw-r--r--utils/TableGen/TableGen.cpp3
9 files changed, 3 insertions, 26 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp b/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp
index 4d567c8..644eaad 100644
--- a/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp
@@ -24,7 +24,6 @@ using namespace llvm;
const char *DwarfAccelTable::Atom::AtomTypeString(enum AtomType AT) {
switch (AT) {
- default: llvm_unreachable("invalid AtomType!");
case eAtomTypeNULL: return "eAtomTypeNULL";
case eAtomTypeDIEOffset: return "eAtomTypeDIEOffset";
case eAtomTypeCUOffset: return "eAtomTypeCUOffset";
@@ -32,6 +31,7 @@ const char *DwarfAccelTable::Atom::AtomTypeString(enum AtomType AT) {
case eAtomTypeNameFlags: return "eAtomTypeNameFlags";
case eAtomTypeTypeFlags: return "eAtomTypeTypeFlags";
}
+ llvm_unreachable("invalid AtomType!");
}
// The general case would need to have a less hard coded size for the
diff --git a/lib/Support/CommandLine.cpp b/lib/Support/CommandLine.cpp
index ce93449..d1f9fad 100644
--- a/lib/Support/CommandLine.cpp
+++ b/lib/Support/CommandLine.cpp
@@ -292,12 +292,6 @@ static inline bool ProvideOption(Option *Handler, StringRef ArgName,
break;
case ValueOptional:
break;
-
- default:
- errs() << ProgramName
- << ": Bad ValueMask flag! CommandLine usage error:"
- << Handler->getValueExpectedFlag() << "\n";
- llvm_unreachable(0);
}
// If this isn't a multi-arg option, just run the handler.
diff --git a/lib/Support/SourceMgr.cpp b/lib/Support/SourceMgr.cpp
index 5a6090d..bbe36b2 100644
--- a/lib/Support/SourceMgr.cpp
+++ b/lib/Support/SourceMgr.cpp
@@ -244,7 +244,6 @@ void SMDiagnostic::print(const char *ProgName, raw_ostream &S) const {
}
switch (Kind) {
- default: assert(0 && "Unknown diagnostic kind");
case SourceMgr::DK_Error: S << "error: "; break;
case SourceMgr::DK_Warning: S << "warning: "; break;
case SourceMgr::DK_Note: S << "note: "; break;
diff --git a/lib/TableGen/Record.cpp b/lib/TableGen/Record.cpp
index 25ff062..bdd6e15 100644
--- a/lib/TableGen/Record.cpp
+++ b/lib/TableGen/Record.cpp
@@ -727,7 +727,6 @@ UnOpInit *UnOpInit::get(UnaryOp opc, Init *lhs, RecTy *Type) {
Init *UnOpInit::Fold(Record *CurRec, MultiClass *CurMultiClass) const {
switch (getOpcode()) {
- default: assert(0 && "Unknown unop");
case CAST: {
if (getType()->getAsString() == "string") {
StringInit *LHSs = dynamic_cast<StringInit*>(LHS);
@@ -880,7 +879,6 @@ BinOpInit *BinOpInit::get(BinaryOp opc, Init *lhs,
Init *BinOpInit::Fold(Record *CurRec, MultiClass *CurMultiClass) const {
switch (getOpcode()) {
- default: assert(0 && "Unknown binop");
case CONCAT: {
DagInit *LHSs = dynamic_cast<DagInit*>(LHS);
DagInit *RHSs = dynamic_cast<DagInit*>(RHS);
@@ -1129,7 +1127,6 @@ static Init *ForeachHelper(Init *LHS, Init *MHS, Init *RHS, RecTy *Type,
Init *TernOpInit::Fold(Record *CurRec, MultiClass *CurMultiClass) const {
switch (getOpcode()) {
- default: assert(0 && "Unknown binop");
case SUBST: {
DefInit *LHSd = dynamic_cast<DefInit*>(LHS);
VarInit *LHSv = dynamic_cast<VarInit*>(LHS);
diff --git a/lib/Target/ARM/ARMConstantPoolValue.cpp b/lib/Target/ARM/ARMConstantPoolValue.cpp
index 9576283..78dc78f 100644
--- a/lib/Target/ARM/ARMConstantPoolValue.cpp
+++ b/lib/Target/ARM/ARMConstantPoolValue.cpp
@@ -48,7 +48,6 @@ ARMConstantPoolValue::~ARMConstantPoolValue() {}
const char *ARMConstantPoolValue::getModifierText() const {
switch (Modifier) {
- default: llvm_unreachable("Unknown modifier!");
// FIXME: Are these case sensitive? It'd be nice to lower-case all the
// strings if that's legal.
case ARMCP::no_modifier: return "none";
@@ -58,6 +57,7 @@ const char *ARMConstantPoolValue::getModifierText() const {
case ARMCP::GOTTPOFF: return "gottpoff";
case ARMCP::TPOFF: return "tpoff";
}
+ llvm_unreachable("Unknown modifier!");
}
int ARMConstantPoolValue::getExistingMachineCPValue(MachineConstantPool *CP,
diff --git a/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
index 7e5e770..021803d 100644
--- a/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
+++ b/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
@@ -2866,8 +2866,6 @@ parseVectorList(SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
if (Res != MatchOperand_Success)
return Res;
switch (LaneKind) {
- default:
- assert(0 && "unexpected lane kind!");
case NoLanes:
E = Parser.getTok().getLoc();
Operands.push_back(ARMOperand::CreateVectorList(Reg, 1, false, S, E));
@@ -2891,8 +2889,6 @@ parseVectorList(SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
if (Res != MatchOperand_Success)
return Res;
switch (LaneKind) {
- default:
- assert(0 && "unexpected lane kind!");
case NoLanes:
E = Parser.getTok().getLoc();
Operands.push_back(ARMOperand::CreateVectorList(Reg, 2, false, S, E));
@@ -3063,8 +3059,6 @@ parseVectorList(SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
Parser.Lex(); // Eat '}' token.
switch (LaneKind) {
- default:
- assert(0 && "unexpected lane kind in register list.");
case NoLanes:
Operands.push_back(ARMOperand::CreateVectorList(FirstReg, Count,
(Spacing == 2), S, E));
diff --git a/lib/Target/Mips/MipsJITInfo.cpp b/lib/Target/Mips/MipsJITInfo.cpp
index 27d5918..b15d290 100644
--- a/lib/Target/Mips/MipsJITInfo.cpp
+++ b/lib/Target/Mips/MipsJITInfo.cpp
@@ -228,9 +228,6 @@ void MipsJITInfo::relocate(void *Function, MachineRelocation *MR,
*((unsigned*) RelocPos) |= (unsigned) ResultPtr;
break;
}
-
- default:
- llvm_unreachable("ERROR: Unknown Mips relocation.");
}
}
}
diff --git a/lib/VMCore/Core.cpp b/lib/VMCore/Core.cpp
index 69fb75f..35315df 100644
--- a/lib/VMCore/Core.cpp
+++ b/lib/VMCore/Core.cpp
@@ -690,12 +690,11 @@ static LLVMOpcode map_to_llvmopcode(int opcode)
static int map_from_llvmopcode(LLVMOpcode code)
{
switch (code) {
- default:
- assert(0 && "Unhandled Opcode.");
#define HANDLE_INST(num, opc, clas) case LLVM##opc: return num;
#include "llvm/Instruction.def"
#undef HANDLE_INST
}
+ llvm_unreachable("Unhandled Opcode.");
}
/*--.. Constant expressions ................................................--*/
diff --git a/utils/TableGen/TableGen.cpp b/utils/TableGen/TableGen.cpp
index 2b1c89d..8c41358 100644
--- a/utils/TableGen/TableGen.cpp
+++ b/utils/TableGen/TableGen.cpp
@@ -178,9 +178,6 @@ namespace {
}
break;
}
- default:
- assert(1 && "Invalid Action");
- return true;
}
return false;