Switch assert(0/false) llvm_unreachable.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140367 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp b/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp
index c63603a..66943fd 100644
--- a/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp
+++ b/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp
@@ -82,7 +82,7 @@
     range = TOR->getExpr()->getSourceRange();
   }
   else {
-    assert(false && "Invalid region in ReturnStackAddressChecker.");
+    llvm_unreachable("Invalid region in ReturnStackAddressChecker.");
   } 
   
   return range;
diff --git a/lib/StaticAnalyzer/Core/AggExprVisitor.cpp b/lib/StaticAnalyzer/Core/AggExprVisitor.cpp
index 901190d..0936d61 100644
--- a/lib/StaticAnalyzer/Core/AggExprVisitor.cpp
+++ b/lib/StaticAnalyzer/Core/AggExprVisitor.cpp
@@ -46,7 +46,7 @@
 void AggExprVisitor::VisitCastExpr(CastExpr *E) {
   switch (E->getCastKind()) {
   default: 
-    assert(0 && "Unhandled cast kind");
+    llvm_unreachable("Unhandled cast kind");
   case CK_NoOp:
   case CK_ConstructorConversion:
   case CK_UserDefinedConversion:
diff --git a/lib/StaticAnalyzer/Core/BugReporter.cpp b/lib/StaticAnalyzer/Core/BugReporter.cpp
index 3936d56..b87c9eb 100644
--- a/lib/StaticAnalyzer/Core/BugReporter.cpp
+++ b/lib/StaticAnalyzer/Core/BugReporter.cpp
@@ -1742,7 +1742,7 @@
     if (!errorNode)
       continue;
     if (errorNode->isSink()) {
-      assert(false &&
+      llvm_unreachable(
            "BugType::isSuppressSink() should not be 'true' for sink end nodes");
       return 0;
     }
diff --git a/lib/StaticAnalyzer/Core/CoreEngine.cpp b/lib/StaticAnalyzer/Core/CoreEngine.cpp
index 06c3af1..6a86042 100644
--- a/lib/StaticAnalyzer/Core/CoreEngine.cpp
+++ b/lib/StaticAnalyzer/Core/CoreEngine.cpp
@@ -326,7 +326,7 @@
   if (const Stmt *Term = B->getTerminator()) {
     switch (Term->getStmtClass()) {
       default:
-        assert(false && "Analysis for this terminator not implemented.");
+        llvm_unreachable("Analysis for this terminator not implemented.");
         break;
 
       case Stmt::BinaryOperatorClass: // '&&' and '||'
@@ -547,7 +547,7 @@
                                     const ProgramPointTag *tag){
   switch (K) {
     default:
-      assert(false && "Unhandled ProgramPoint kind");    
+      llvm_unreachable("Unhandled ProgramPoint kind");    
     case ProgramPoint::PreStmtKind:
       return PreStmt(S, LC, tag);
     case ProgramPoint::PostStmtKind:
diff --git a/lib/StaticAnalyzer/Core/ExprEngine.cpp b/lib/StaticAnalyzer/Core/ExprEngine.cpp
index 37362d3..5e38f2f 100644
--- a/lib/StaticAnalyzer/Core/ExprEngine.cpp
+++ b/lib/StaticAnalyzer/Core/ExprEngine.cpp
@@ -1030,7 +1030,7 @@
       }
     }
 
-    assert(false && "No block with label.");
+    llvm_unreachable("No block with label.");
     return;
   }
 
diff --git a/lib/StaticAnalyzer/Core/ExprEngineC.cpp b/lib/StaticAnalyzer/Core/ExprEngineC.cpp
index 0daa252..955684f 100644
--- a/lib/StaticAnalyzer/Core/ExprEngineC.cpp
+++ b/lib/StaticAnalyzer/Core/ExprEngineC.cpp
@@ -74,7 +74,7 @@
     
     switch (Op) {
       default:
-        assert(0 && "Invalid opcode for compound assignment.");
+        llvm_unreachable("Invalid opcode for compound assignment.");
       case BO_MulAssign: Op = BO_Mul; break;
       case BO_DivAssign: Op = BO_Div; break;
       case BO_RemAssign: Op = BO_Rem; break;
@@ -203,9 +203,9 @@
     
     switch (CastE->getCastKind()) {
       case CK_LValueToRValue:
-        assert(false && "LValueToRValue casts handled earlier.");
+        llvm_unreachable("LValueToRValue casts handled earlier.");
       case CK_GetObjCProperty:
-        assert(false && "GetObjCProperty casts handled earlier.");
+        llvm_unreachable("GetObjCProperty casts handled earlier.");
       case CK_ToVoid:
         Dst.Add(Pred);
         continue;
@@ -625,7 +625,7 @@
         
         switch (U->getOpcode()) {
           default:
-            assert(false && "Invalid Opcode.");
+            llvm_unreachable("Invalid Opcode.");
             break;
             
           case UO_Not:
diff --git a/lib/StaticAnalyzer/Core/RegionStore.cpp b/lib/StaticAnalyzer/Core/RegionStore.cpp
index 04c274d..18fbf83 100644
--- a/lib/StaticAnalyzer/Core/RegionStore.cpp
+++ b/lib/StaticAnalyzer/Core/RegionStore.cpp
@@ -891,7 +891,7 @@
   }
 
   if (isa<CodeTextRegion>(MR)) {
-    assert(0 && "Why load from a code text region?");
+    llvm_unreachable("Why load from a code text region?");
     return UnknownVal();
   }
 
@@ -1130,7 +1130,7 @@
     if (isa<nonloc::LazyCompoundVal>(val))
       return Optional<SVal>();
 
-    assert(0 && "Unknown default value");
+    llvm_unreachable("Unknown default value");
   }
 
   return Optional<SVal>();
diff --git a/lib/StaticAnalyzer/Core/SVals.cpp b/lib/StaticAnalyzer/Core/SVals.cpp
index 8eb65ba..e32a3b0 100644
--- a/lib/StaticAnalyzer/Core/SVals.cpp
+++ b/lib/StaticAnalyzer/Core/SVals.cpp
@@ -171,7 +171,7 @@
     return;
   }
 
-  assert(false && "unhandled expansion case");
+  llvm_unreachable("unhandled expansion case");
 }
 
 const void *nonloc::LazyCompoundVal::getStore() const {
@@ -369,7 +369,7 @@
       break;
     }
     default:
-      assert(false && "Pretty-printing not implemented for this Loc.");
+      llvm_unreachable("Pretty-printing not implemented for this Loc.");
       break;
   }
 }
diff --git a/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp b/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp
index 73b4d78..79d8b8b 100644
--- a/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp
+++ b/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp
@@ -125,7 +125,7 @@
   // the only place it's used. (This code was copied from SimpleSValBuilder.cpp.)
   switch (op) {
   default:
-    assert(false && "Invalid opcode.");
+    llvm_unreachable("Invalid opcode.");
   case BO_LT: return BO_GE;
   case BO_GT: return BO_LE;
   case BO_LE: return BO_GT;
@@ -152,7 +152,7 @@
 
   switch (Cond.getSubKind()) {
   default:
-    assert(false && "'Assume' not implemented for this NonLoc");
+    llvm_unreachable("'Assume' not implemented for this NonLoc");
 
   case nonloc::SymbolValKind: {
     nonloc::SymbolVal& SV = cast<nonloc::SymbolVal>(Cond);
diff --git a/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp b/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
index 787aa05..830d70e 100644
--- a/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
+++ b/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
@@ -171,7 +171,7 @@
 static BinaryOperator::Opcode NegateComparison(BinaryOperator::Opcode op) {
   switch (op) {
   default:
-    assert(false && "Invalid opcode.");
+    llvm_unreachable("Invalid opcode.");
   case BO_LT: return BO_GE;
   case BO_GT: return BO_LE;
   case BO_LE: return BO_GT;
@@ -184,7 +184,7 @@
 static BinaryOperator::Opcode ReverseComparison(BinaryOperator::Opcode op) {
   switch (op) {
   default:
-    assert(false && "Invalid opcode.");
+    llvm_unreachable("Invalid opcode.");
   case BO_LT: return BO_GT;
   case BO_GT: return BO_LT;
   case BO_LE: return BO_GE;
@@ -347,7 +347,7 @@
           break;
         case BO_LAnd:
         case BO_LOr:
-          assert(false && "Logical operators handled by branching logic.");
+          llvm_unreachable("Logical operators handled by branching logic.");
           return UnknownVal();
         case BO_Assign:
         case BO_MulAssign:
@@ -361,11 +361,11 @@
         case BO_XorAssign:
         case BO_OrAssign:
         case BO_Comma:
-          assert(false && "'=' and ',' operators handled by ExprEngine.");
+          llvm_unreachable("'=' and ',' operators handled by ExprEngine.");
           return UnknownVal();
         case BO_PtrMemD:
         case BO_PtrMemI:
-          assert(false && "Pointer arithmetic not handled here.");
+          llvm_unreachable("Pointer arithmetic not handled here.");
           return UnknownVal();
         case BO_LT:
         case BO_GT:
@@ -556,7 +556,7 @@
   if (lhs == rhs) {
     switch (op) {
     default:
-      assert(false && "Unimplemented operation for two identical values");
+      llvm_unreachable("Unimplemented operation for two identical values");
       return UnknownVal();
     case BO_Sub:
       return makeZeroVal(resultTy);
@@ -573,7 +573,7 @@
 
   switch (lhs.getSubKind()) {
   default:
-    assert(false && "Ordering not implemented for this Loc.");
+    llvm_unreachable("Ordering not implemented for this Loc.");
     return UnknownVal();
 
   case loc::GotoLabelKind:
@@ -827,7 +827,7 @@
           return makeTruthVal(!leftFirst, resultTy);
       }
 
-      assert(false && "Fields not found in parent record's definition");
+      llvm_unreachable("Fields not found in parent record's definition");
     }
 
     // If we get here, we have no way of comparing the regions.
diff --git a/lib/StaticAnalyzer/Core/Store.cpp b/lib/StaticAnalyzer/Core/Store.cpp
index 127d583..63550d4 100644
--- a/lib/StaticAnalyzer/Core/Store.cpp
+++ b/lib/StaticAnalyzer/Core/Store.cpp
@@ -103,7 +103,7 @@
     case MemRegion::UnknownSpaceRegionKind:
     case MemRegion::NonStaticGlobalSpaceRegionKind:
     case MemRegion::StaticGlobalSpaceRegionKind: {
-      assert(0 && "Invalid region cast");
+      llvm_unreachable("Invalid region cast");
       break;
     }
 
@@ -203,7 +203,7 @@
     }
   }
 
-  assert(0 && "unreachable");
+  llvm_unreachable("unreachable");
   return 0;
 }
 
@@ -261,7 +261,7 @@
     return Base;
 
   default:
-    assert(0 && "Unhandled Base.");
+    llvm_unreachable("Unhandled Base.");
     return Base;
   }
 
diff --git a/lib/StaticAnalyzer/Core/SymbolManager.cpp b/lib/StaticAnalyzer/Core/SymbolManager.cpp
index 255b914..32ad581 100644
--- a/lib/StaticAnalyzer/Core/SymbolManager.cpp
+++ b/lib/StaticAnalyzer/Core/SymbolManager.cpp
@@ -28,7 +28,7 @@
 static void print(raw_ostream &os, BinaryOperator::Opcode Op) {
   switch (Op) {
     default:
-      assert(false && "operator printing not implemented");
+      llvm_unreachable("operator printing not implemented");
       break;
     case BO_Mul: os << '*'  ; break;
     case BO_Div: os << '/'  ; break;
diff --git a/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp b/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
index 76ca477..c4619e3 100644
--- a/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
+++ b/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
@@ -102,7 +102,7 @@
     // Create the analyzer component creators.
     switch (Opts.AnalysisStoreOpt) {
     default:
-      assert(0 && "Unknown store manager.");
+      llvm_unreachable("Unknown store manager.");
 #define ANALYSIS_STORE(NAME, CMDFLAG, DESC, CREATEFN)           \
       case NAME##Model: CreateStoreMgr = CREATEFN; break;
 #include "clang/Frontend/Analyses.def"
@@ -110,7 +110,7 @@
 
     switch (Opts.AnalysisConstraintsOpt) {
     default:
-      assert(0 && "Unknown store manager.");
+      llvm_unreachable("Unknown store manager.");
 #define ANALYSIS_CONSTRAINTS(NAME, CMDFLAG, DESC, CREATEFN)     \
       case NAME##Model: CreateConstraintMgr = CREATEFN; break;
 #include "clang/Frontend/Analyses.def"