diff options
author | David Blaikie <dblaikie@gmail.com> | 2012-01-17 02:30:50 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2012-01-17 02:30:50 +0000 |
commit | 561d3abc881033776ece385a01a510e1cbc1fa92 (patch) | |
tree | a80145468cfab3a1d501d747beb91214dbd4b88c | |
parent | 5e192a7d60e776fa65e633cd9c2a0d59df132f23 (diff) |
Remove unnecessary default cases in switches over enums.
This allows -Wswitch-enum to find switches that need updating when these enums are modified.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148281 91177308-0d34-0410-b5e6-96231b3b80d8
37 files changed, 14 insertions, 66 deletions
diff --git a/include/clang/AST/DeclVisitor.h b/include/clang/AST/DeclVisitor.h index b5b6bd42dd..62654b8115 100644 --- a/include/clang/AST/DeclVisitor.h +++ b/include/clang/AST/DeclVisitor.h @@ -30,12 +30,12 @@ class DeclVisitor { public: RetTy Visit(Decl *D) { switch (D->getKind()) { - default: llvm_unreachable("Decl that isn't part of DeclNodes.inc!"); #define DECL(DERIVED, BASE) \ case Decl::DERIVED: DISPATCH(DERIVED##Decl, DERIVED##Decl); #define ABSTRACT_DECL(DECL) #include "clang/AST/DeclNodes.inc" } + llvm_unreachable("Decl that isn't part of DeclNodes.inc!"); } // If the implementation chooses not to implement a certain visit diff --git a/include/clang/AST/RecursiveASTVisitor.h b/include/clang/AST/RecursiveASTVisitor.h index d22d67dbc2..7aa43ad544 100644 --- a/include/clang/AST/RecursiveASTVisitor.h +++ b/include/clang/AST/RecursiveASTVisitor.h @@ -1357,8 +1357,6 @@ bool RecursiveASTVisitor<Derived>::TraverseFunctionInstantiations( case TSK_Undeclared: // Declaration of the template definition. case TSK_ExplicitSpecialization: break; - default: - llvm_unreachable("Unknown specialization kind."); } } diff --git a/include/clang/AST/StmtVisitor.h b/include/clang/AST/StmtVisitor.h index 48a0123608..38c4c0220e 100644 --- a/include/clang/AST/StmtVisitor.h +++ b/include/clang/AST/StmtVisitor.h @@ -42,7 +42,6 @@ public: // below. if (PTR(BinaryOperator) BinOp = dyn_cast<BinaryOperator>(S)) { switch (BinOp->getOpcode()) { - default: llvm_unreachable("Unknown binary operator!"); case BO_PtrMemD: DISPATCH(BinPtrMemD, BinaryOperator); case BO_PtrMemI: DISPATCH(BinPtrMemI, BinaryOperator); case BO_Mul: DISPATCH(BinMul, BinaryOperator); @@ -80,7 +79,6 @@ public: } } else if (PTR(UnaryOperator) UnOp = dyn_cast<UnaryOperator>(S)) { switch (UnOp->getOpcode()) { - default: llvm_unreachable("Unknown unary operator!"); case UO_PostInc: DISPATCH(UnaryPostInc, UnaryOperator); case UO_PostDec: DISPATCH(UnaryPostDec, UnaryOperator); case UO_PreInc: DISPATCH(UnaryPreInc, UnaryOperator); diff --git a/include/clang/AST/TypeVisitor.h b/include/clang/AST/TypeVisitor.h index 9eebc4b9ea..242aa586d5 100644 --- a/include/clang/AST/TypeVisitor.h +++ b/include/clang/AST/TypeVisitor.h @@ -28,11 +28,11 @@ public: RetTy Visit(const Type *T) { // Top switch stmt: dispatch to VisitFooType for each FooType. switch (T->getTypeClass()) { - default: llvm_unreachable("Unknown type class!"); #define ABSTRACT_TYPE(CLASS, PARENT) #define TYPE(CLASS, PARENT) case Type::CLASS: DISPATCH(CLASS##Type); #include "clang/AST/TypeNodes.def" } + llvm_unreachable("Unknown type class!"); } // If the implementation chooses not to implement a certain visit method, fall diff --git a/include/clang/Sema/DeclSpec.h b/include/clang/Sema/DeclSpec.h index edc6fd3bc9..6a180e85ae 100644 --- a/include/clang/Sema/DeclSpec.h +++ b/include/clang/Sema/DeclSpec.h @@ -1250,7 +1250,6 @@ struct DeclaratorChunk { void destroy() { switch (Kind) { - default: llvm_unreachable("Unknown decl type!"); case DeclaratorChunk::Function: return Fun.destroy(); case DeclaratorChunk::Pointer: return Ptr.destroy(); case DeclaratorChunk::BlockPointer: return Cls.destroy(); diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 048d9e873e..e145eecf42 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -3569,7 +3569,7 @@ QualType ASTContext::getFloatingTypeOfSizeWithinDomain(QualType Size, FloatingRank EltRank = getFloatingRank(Size); if (Domain->isComplexType()) { switch (EltRank) { - default: llvm_unreachable("getFloatingRank(): illegal value for rank"); + case HalfRank: llvm_unreachable("Complex half is not supported"); case FloatRank: return FloatComplexTy; case DoubleRank: return DoubleComplexTy; case LongDoubleRank: return LongDoubleComplexTy; @@ -3578,11 +3578,12 @@ QualType ASTContext::getFloatingTypeOfSizeWithinDomain(QualType Size, assert(Domain->isRealFloatingType() && "Unknown domain!"); switch (EltRank) { - default: llvm_unreachable("getFloatingRank(): illegal value for rank"); + case HalfRank: llvm_unreachable("Half ranks are not valid here"); case FloatRank: return FloatTy; case DoubleRank: return DoubleTy; case LongDoubleRank: return LongDoubleTy; } + llvm_unreachable("getFloatingRank(): illegal value for rank"); } /// getFloatingTypeOrder - Compare the rank of the two specified floating diff --git a/lib/AST/DeclBase.cpp b/lib/AST/DeclBase.cpp index 47d2def396..3763ebd2f7 100644 --- a/lib/AST/DeclBase.cpp +++ b/lib/AST/DeclBase.cpp @@ -119,7 +119,6 @@ void Decl::PrintStats() { void Decl::add(Kind k) { switch (k) { - default: llvm_unreachable("Declaration not in DeclNodes.inc!"); #define DECL(DERIVED, BASE) case DERIVED: ++n##DERIVED##s; break; #define ABSTRACT_DECL(DECL) #include "clang/AST/DeclNodes.inc" diff --git a/lib/AST/DeclCXX.cpp b/lib/AST/DeclCXX.cpp index 3f4d2e4c71..b09b672095 100644 --- a/lib/AST/DeclCXX.cpp +++ b/lib/AST/DeclCXX.cpp @@ -1941,7 +1941,6 @@ StaticAssertDecl *StaticAssertDecl::CreateDeserialized(ASTContext &C, static const char *getAccessName(AccessSpecifier AS) { switch (AS) { - default: case AS_none: llvm_unreachable("Invalid access specifier!"); case AS_public: @@ -1951,6 +1950,7 @@ static const char *getAccessName(AccessSpecifier AS) { case AS_protected: return "protected"; } + llvm_unreachable("Invalid access specifier!"); } const DiagnosticBuilder &clang::operator<<(const DiagnosticBuilder &DB, diff --git a/lib/AST/DumpXML.cpp b/lib/AST/DumpXML.cpp index 34c6a8f787..9dd5a010f0 100644 --- a/lib/AST/DumpXML.cpp +++ b/lib/AST/DumpXML.cpp @@ -66,7 +66,6 @@ template <class Impl> struct XMLDeclVisitor { void dispatch(Decl *D) { switch (D->getKind()) { - default: llvm_unreachable("Decl that isn't part of DeclNodes.inc!"); #define DECL(DERIVED, BASE) \ case Decl::DERIVED: \ DISPATCH(dispatch##DERIVED##DeclAttrs, DERIVED##Decl); \ @@ -121,7 +120,6 @@ template <class Impl> struct XMLTypeVisitor { void dispatch(Type *T) { switch (T->getTypeClass()) { - default: llvm_unreachable("Type that isn't part of TypeNodes.inc!"); #define TYPE(DERIVED, BASE) \ case Type::DERIVED: \ DISPATCH(dispatch##DERIVED##TypeAttrs, DERIVED##Type); \ diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index bffcccc606..7fc0700311 100644 --- a/lib/AST/Expr.cpp +++ b/lib/AST/Expr.cpp @@ -652,7 +652,6 @@ getLocationOfByte(unsigned ByteNo, const SourceManager &SM, /// corresponds to, e.g. "sizeof" or "[pre]++". const char *UnaryOperator::getOpcodeStr(Opcode Op) { switch (Op) { - default: llvm_unreachable("Unknown unary operator"); case UO_PostInc: return "++"; case UO_PostDec: return "--"; case UO_PreInc: return "++"; @@ -667,6 +666,7 @@ const char *UnaryOperator::getOpcodeStr(Opcode Op) { case UO_Imag: return "__imag"; case UO_Extension: return "__extension__"; } + llvm_unreachable("Unknown unary operator"); } UnaryOperatorKind diff --git a/lib/AST/TypePrinter.cpp b/lib/AST/TypePrinter.cpp index e11e506572..5dd42721d3 100644 --- a/lib/AST/TypePrinter.cpp +++ b/lib/AST/TypePrinter.cpp @@ -427,8 +427,7 @@ void TypePrinter::printFunctionProto(const FunctionProtoType *T, FunctionType::ExtInfo Info = T->getExtInfo(); switch(Info.getCC()) { - case CC_Default: - default: break; + case CC_Default: break; case CC_C: S += " __attribute__((cdecl))"; break; diff --git a/lib/Basic/DiagnosticIDs.cpp b/lib/Basic/DiagnosticIDs.cpp index 1f7777873c..b3c4d033c2 100644 --- a/lib/Basic/DiagnosticIDs.cpp +++ b/lib/Basic/DiagnosticIDs.cpp @@ -532,7 +532,6 @@ DiagnosticIDs::getDiagnosticLevel(unsigned DiagID, unsigned DiagClass, (diag::kind)DiagID); switch (MappingInfo.getMapping()) { - default: llvm_unreachable("Unknown mapping!"); case diag::MAP_IGNORE: Result = DiagnosticIDs::Ignored; break; diff --git a/lib/CodeGen/CGBuiltin.cpp b/lib/CodeGen/CGBuiltin.cpp index 3e5a6772eb..61fce424a8 100644 --- a/lib/CodeGen/CGBuiltin.cpp +++ b/lib/CodeGen/CGBuiltin.cpp @@ -1191,7 +1191,6 @@ Value *CodeGenFunction::EmitTargetBuiltinExpr(unsigned BuiltinID, static llvm::VectorType *GetNeonType(LLVMContext &C, NeonTypeFlags TypeFlags) { int IsQuad = TypeFlags.isQuad(); switch (TypeFlags.getEltType()) { - default: break; case NeonTypeFlags::Int8: case NeonTypeFlags::Poly8: return llvm::VectorType::get(llvm::Type::getInt8Ty(C), 8 << IsQuad); @@ -1205,8 +1204,8 @@ static llvm::VectorType *GetNeonType(LLVMContext &C, NeonTypeFlags TypeFlags) { return llvm::VectorType::get(llvm::Type::getInt64Ty(C), 1 << IsQuad); case NeonTypeFlags::Float32: return llvm::VectorType::get(llvm::Type::getFloatTy(C), 2 << IsQuad); - }; - return 0; + } + llvm_unreachable("Invalid NeonTypeFlags element type!"); } Value *CodeGenFunction::EmitNeonSplat(Value *V, Constant *C) { diff --git a/lib/CodeGen/CGObjCGNU.cpp b/lib/CodeGen/CGObjCGNU.cpp index 818186c901..140e9242a5 100644 --- a/lib/CodeGen/CGObjCGNU.cpp +++ b/lib/CodeGen/CGObjCGNU.cpp @@ -1191,8 +1191,6 @@ CGObjCGNU::GenerateMessageSend(CodeGenFunction &CGF, // functions. These are not supported on all platforms (or all runtimes on a // given platform), so we switch (CGM.getCodeGenOpts().getObjCDispatchMethod()) { - default: - llvm_unreachable("Invalid dispatch method!"); case CodeGenOptions::Legacy: imp = LookupIMP(CGF, Receiver, cmd, node); break; diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp index 3ea7e4b38c..3171d988d3 100644 --- a/lib/CodeGen/CGObjCMac.cpp +++ b/lib/CodeGen/CGObjCMac.cpp @@ -4756,8 +4756,6 @@ bool CGObjCNonFragileABIMac::isVTableDispatchedSelector(Selector Sel) { // At various points we've experimented with using vtable-based // dispatch for all methods. switch (CGM.getCodeGenOpts().getObjCDispatchMethod()) { - default: - llvm_unreachable("Invalid dispatch method!"); case CodeGenOptions::Legacy: return false; case CodeGenOptions::NonLegacy: diff --git a/lib/Driver/Option.cpp b/lib/Driver/Option.cpp index ee1963fd33..03360ea2d8 100644 --- a/lib/Driver/Option.cpp +++ b/lib/Driver/Option.cpp @@ -61,8 +61,6 @@ Option::~Option() { void Option::dump() const { llvm::errs() << "<"; switch (Kind) { - default: - llvm_unreachable("Invalid kind"); #define P(N) case N: llvm::errs() << #N; break P(GroupClass); P(InputClass); diff --git a/lib/Frontend/LangStandards.cpp b/lib/Frontend/LangStandards.cpp index abb521ba27..f86a574c30 100644 --- a/lib/Frontend/LangStandards.cpp +++ b/lib/Frontend/LangStandards.cpp @@ -19,14 +19,13 @@ using namespace clang::frontend; const LangStandard &LangStandard::getLangStandardForKind(Kind K) { switch (K) { - default: - llvm_unreachable("Invalid language kind!"); case lang_unspecified: llvm::report_fatal_error("getLangStandardForKind() on unspecified kind"); #define LANGSTANDARD(id, name, desc, features) \ case lang_##id: return Lang_##id; #include "clang/Frontend/LangStandards.def" } + llvm_unreachable("Invalid language kind!"); } const LangStandard *LangStandard::getLangStandardForName(StringRef Name) { diff --git a/lib/Frontend/LogDiagnosticPrinter.cpp b/lib/Frontend/LogDiagnosticPrinter.cpp index 8b585be90e..8eb46732b9 100644 --- a/lib/Frontend/LogDiagnosticPrinter.cpp +++ b/lib/Frontend/LogDiagnosticPrinter.cpp @@ -12,6 +12,7 @@ #include "clang/Basic/SourceManager.h" #include "llvm/ADT/SmallString.h" #include "llvm/Support/raw_ostream.h" +#include "llvm/Support/ErrorHandling.h" using namespace clang; LogDiagnosticPrinter::LogDiagnosticPrinter(raw_ostream &os, @@ -28,14 +29,13 @@ LogDiagnosticPrinter::~LogDiagnosticPrinter() { static StringRef getLevelName(DiagnosticsEngine::Level Level) { switch (Level) { - default: - return "<unknown>"; case DiagnosticsEngine::Ignored: return "ignored"; case DiagnosticsEngine::Note: return "note"; case DiagnosticsEngine::Warning: return "warning"; case DiagnosticsEngine::Error: return "error"; case DiagnosticsEngine::Fatal: return "fatal error"; } + llvm_unreachable("Invalid DiagnosticsEngine level!"); } // Escape XML characters inside the raw string. diff --git a/lib/Frontend/PrintPreprocessedOutput.cpp b/lib/Frontend/PrintPreprocessedOutput.cpp index d52b25bf0b..5e76a79ae1 100644 --- a/lib/Frontend/PrintPreprocessedOutput.cpp +++ b/lib/Frontend/PrintPreprocessedOutput.cpp @@ -389,7 +389,6 @@ PragmaDiagnostic(SourceLocation Loc, StringRef Namespace, MoveToLine(Loc); OS << "#pragma " << Namespace << " diagnostic "; switch (Map) { - default: llvm_unreachable("unexpected diagnostic kind"); case diag::MAP_WARNING: OS << "warning"; break; diff --git a/lib/FrontendTool/ExecuteCompilerInvocation.cpp b/lib/FrontendTool/ExecuteCompilerInvocation.cpp index fec12e3b11..2782a85beb 100644 --- a/lib/FrontendTool/ExecuteCompilerInvocation.cpp +++ b/lib/FrontendTool/ExecuteCompilerInvocation.cpp @@ -32,9 +32,6 @@ static FrontendAction *CreateFrontendBaseAction(CompilerInstance &CI) { using namespace clang::frontend; switch (CI.getFrontendOpts().ProgramAction) { - default: - llvm_unreachable("Invalid program action!"); - case ASTDump: return new ASTDumpAction(); case ASTDumpXML: return new ASTDumpXMLAction(); case ASTPrint: return new ASTPrintAction(); @@ -81,6 +78,7 @@ static FrontendAction *CreateFrontendBaseAction(CompilerInstance &CI) { case RunAnalysis: return new ento::AnalysisAction(); case RunPreprocessorOnly: return new PreprocessOnlyAction(); } + llvm_unreachable("Invalid program action!"); } static FrontendAction *CreateFrontendAction(CompilerInstance &CI) { diff --git a/lib/Index/ASTLocation.cpp b/lib/Index/ASTLocation.cpp index 66b393eb65..a8537b1a1a 100644 --- a/lib/Index/ASTLocation.cpp +++ b/lib/Index/ASTLocation.cpp @@ -41,7 +41,6 @@ Decl *ASTLocation::getReferencedDecl() { return 0; switch (getKind()) { - default: llvm_unreachable("Invalid Kind"); case N_Type: return 0; case N_Decl: @@ -60,7 +59,6 @@ SourceRange ASTLocation::getSourceRange() const { return SourceRange(); switch (getKind()) { - default: llvm_unreachable("Invalid Kind"); case N_Decl: return D->getSourceRange(); case N_Stmt: diff --git a/lib/Parse/ParseExprCXX.cpp b/lib/Parse/ParseExprCXX.cpp index cad0a4ae6c..f1cedfebfd 100644 --- a/lib/Parse/ParseExprCXX.cpp +++ b/lib/Parse/ParseExprCXX.cpp @@ -2463,8 +2463,6 @@ ExprResult Parser::ParseArrayTypeTrait() { return Actions.ActOnArrayTypeTrait(ATT, Loc, Ty.get(), DimExpr.get(), T.getCloseLocation()); } - default: - break; } return ExprError(); } diff --git a/lib/Sema/SemaAttr.cpp b/lib/Sema/SemaAttr.cpp index 77410db01f..6aae8db391 100644 --- a/lib/Sema/SemaAttr.cpp +++ b/lib/Sema/SemaAttr.cpp @@ -263,9 +263,6 @@ void Sema::ActOnPragmaPack(PragmaPackKind Kind, IdentifierInfo *Name, Context->setAlignment(AlignmentVal); } break; - - default: - llvm_unreachable("Invalid #pragma pack kind."); } } diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index a8dc75d0df..6196ea3f6c 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -291,7 +291,6 @@ DeclSpec::TST Sema::isTagName(IdentifierInfo &II, Scope *S) { if (R.getResultKind() == LookupResult::Found) if (const TagDecl *TD = R.getAsSingle<TagDecl>()) { switch (TD->getTagKind()) { - default: return DeclSpec::TST_unspecified; case TTK_Struct: return DeclSpec::TST_struct; case TTK_Union: return DeclSpec::TST_union; case TTK_Class: return DeclSpec::TST_class; diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index cdba6208db..43bdf3f930 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -1055,8 +1055,6 @@ static void handleOwnershipAttr(Sema &S, Decl *D, const AttributeList &AL) { } break; } - default: - llvm_unreachable("Unknown ownership attribute"); } // switch // Check we don't have a conflict with another ownership attribute. diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 1655c9105f..741ca9edd0 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -9163,7 +9163,6 @@ bool Sema::DiagnoseAssignmentResult(AssignConvertType ConvTy, bool MayHaveFunctionDiff = false; switch (ConvTy) { - default: llvm_unreachable("Unknown conversion type"); case Compatible: return false; case PointerToInt: DiagKind = diag::ext_typecheck_convert_pointer_int; diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp index a4282e2946..cd8505932b 100644 --- a/lib/Sema/SemaInit.cpp +++ b/lib/Sema/SemaInit.cpp @@ -2642,7 +2642,6 @@ void InitializationSequence::AddDerivedToBaseCastStep(QualType BaseType, case VK_RValue: S.Kind = SK_CastDerivedToBaseRValue; break; case VK_XValue: S.Kind = SK_CastDerivedToBaseXValue; break; case VK_LValue: S.Kind = SK_CastDerivedToBaseLValue; break; - default: llvm_unreachable("No such category"); } S.Type = BaseType; Steps.push_back(S); diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index 654bed270b..0d30749266 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -1972,7 +1972,6 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state, state.setCurrentChunkIndex(chunkIndex); DeclaratorChunk &DeclType = D.getTypeObject(chunkIndex); switch (DeclType.Kind) { - default: llvm_unreachable("Unknown decltype!"); case DeclaratorChunk::Paren: T = S.BuildParenType(T); break; diff --git a/lib/Serialization/ASTReaderDecl.cpp b/lib/Serialization/ASTReaderDecl.cpp index 8becd35d54..7fc54bbba4 100644 --- a/lib/Serialization/ASTReaderDecl.cpp +++ b/lib/Serialization/ASTReaderDecl.cpp @@ -509,7 +509,6 @@ void ASTDeclReader::VisitFunctionDecl(FunctionDecl *FD) { FD->EndRangeLoc = ReadSourceLocation(Record, Idx); switch ((FunctionDecl::TemplatedKind)Record[Idx++]) { - default: llvm_unreachable("Unhandled TemplatedKind!"); case FunctionDecl::TK_NonTemplate: mergeRedeclarable(FD, Redecl); break; @@ -1125,8 +1124,6 @@ void ASTDeclReader::VisitCXXRecordDecl(CXXRecordDecl *D) { CXXRecNotTemplate = 0, CXXRecTemplate, CXXRecMemberSpecialization }; switch ((CXXRecKind)Record[Idx++]) { - default: - llvm_unreachable("Out of sync with ASTDeclWriter::VisitCXXRecordDecl?"); case CXXRecNotTemplate: break; case CXXRecTemplate: diff --git a/lib/Serialization/ASTWriterDecl.cpp b/lib/Serialization/ASTWriterDecl.cpp index 8829dc630c..4e8a4cf0d6 100644 --- a/lib/Serialization/ASTWriterDecl.cpp +++ b/lib/Serialization/ASTWriterDecl.cpp @@ -324,7 +324,6 @@ void ASTDeclWriter::VisitFunctionDecl(FunctionDecl *D) { Record.push_back(D->getTemplatedKind()); switch (D->getTemplatedKind()) { - default: llvm_unreachable("Unhandled TemplatedKind!"); case FunctionDecl::TK_NonTemplate: break; case FunctionDecl::TK_FunctionTemplate: diff --git a/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp b/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp index 448c750039..75a93eff4a 100644 --- a/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp @@ -109,9 +109,6 @@ public: const char *BugType = 0; switch (dsk) { - default: - llvm_unreachable("Impossible dead store type."); - case DeadInit: BugType = "Dead initialization"; os << "Value stored to '" << *V diff --git a/lib/StaticAnalyzer/Checkers/MallocChecker.cpp b/lib/StaticAnalyzer/Checkers/MallocChecker.cpp index ea42da4067..3969ee0ef8 100644 --- a/lib/StaticAnalyzer/Checkers/MallocChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/MallocChecker.cpp @@ -191,8 +191,6 @@ bool MallocChecker::evalCall(const CallExpr *CE, CheckerContext &C) const { rv = true; break; } - default: - break; } } } diff --git a/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp b/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp index 8ba1edbb41..59d0495d0a 100644 --- a/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp @@ -1099,7 +1099,6 @@ RetainSummaryManager::getUnarySummary(const FunctionType* FT, case cfretain: Effect = IncRef; break; case cfrelease: Effect = DecRef; break; case cfmakecollectable: Effect = MakeCollectable; break; - default: llvm_unreachable("Not a supported unary function."); } ScratchArgs = AF.add(ScratchArgs, 0, Effect); diff --git a/lib/StaticAnalyzer/Core/SVals.cpp b/lib/StaticAnalyzer/Core/SVals.cpp index 27d6e3eed1..64c1110abc 100644 --- a/lib/StaticAnalyzer/Core/SVals.cpp +++ b/lib/StaticAnalyzer/Core/SVals.cpp @@ -245,8 +245,6 @@ void SVal::dumpToStream(raw_ostream &os) const { case UndefinedKind: os << "Undefined"; break; - default: - assert (false && "Invalid SVal."); } } diff --git a/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp b/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp index 049d419b4b..e13b86c1c1 100644 --- a/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp +++ b/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp @@ -340,8 +340,6 @@ static void RunPathSensitiveChecks(AnalysisConsumer &C, AnalysisManager &mgr, Decl *D) { switch (mgr.getLangOptions().getGC()) { - default: - llvm_unreachable("Invalid GC mode."); case LangOptions::NonGC: ActionExprEngine(C, mgr, D, false); break; diff --git a/tools/libclang/CXType.cpp b/tools/libclang/CXType.cpp index 52e77bda08..eba0405994 100644 --- a/tools/libclang/CXType.cpp +++ b/tools/libclang/CXType.cpp @@ -443,8 +443,6 @@ CXCallingConv clang_getFunctionTypeCallingConv(CXType X) { TCALLINGCONV(X86Pascal); TCALLINGCONV(AAPCS); TCALLINGCONV(AAPCS_VFP); - default: - return CXCallingConv_Unexposed; } #undef TCALLINGCONV } diff --git a/utils/TableGen/TableGen.cpp b/utils/TableGen/TableGen.cpp index 56b28db4e2..1d5e28d936 100644 --- a/utils/TableGen/TableGen.cpp +++ b/utils/TableGen/TableGen.cpp @@ -156,9 +156,6 @@ public: case GenArmNeonTest: NeonEmitter(Records).runTests(OS); break; - default: - assert(1 && "Invalid Action"); - return true; } return false; |