r211143 - Replace some assert(0)'s with llvm_unreachable.
Craig Topper
craig.topper at gmail.com
Tue Jun 17 22:13:14 PDT 2014
Author: ctopper
Date: Wed Jun 18 00:13:13 2014
New Revision: 211143
URL: http://llvm.org/viewvc/llvm-project?rev=211143&view=rev
Log:
Replace some assert(0)'s with llvm_unreachable.
Modified:
cfe/trunk/lib/AST/ASTDiagnostic.cpp
cfe/trunk/lib/Sema/Sema.cpp
cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp
Modified: cfe/trunk/lib/AST/ASTDiagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDiagnostic.cpp?rev=211143&r1=211142&r2=211143&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTDiagnostic.cpp (original)
+++ cfe/trunk/lib/AST/ASTDiagnostic.cpp Wed Jun 18 00:13:13 2014
@@ -1132,7 +1132,7 @@ class TemplateDiff {
ArgExpr = Iter.getDesugar().getAsExpr();
return ArgExpr->EvaluateKnownConstInt(Context);
default:
- assert(0 && "Unexpected template argument kind");
+ llvm_unreachable("Unexpected template argument kind");
}
return ArgExpr->EvaluateKnownConstInt(Context);
}
@@ -1150,7 +1150,7 @@ class TemplateDiff {
ArgExpr = Iter.getDesugar().getAsExpr();
return cast<DeclRefExpr>(ArgExpr)->getDecl();
default:
- assert(0 && "Unexpected template argument kind");
+ llvm_unreachable("Unexpected template argument kind");
}
DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(ArgExpr);
if (!DRE) {
Modified: cfe/trunk/lib/Sema/Sema.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.cpp?rev=211143&r1=211142&r2=211143&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/Sema.cpp (original)
+++ cfe/trunk/lib/Sema/Sema.cpp Wed Jun 18 00:13:13 2014
@@ -313,7 +313,8 @@ ExprResult Sema::ImpCastExprToType(Expr
if (VK == VK_RValue && !E->isRValue()) {
switch (Kind) {
default:
- assert(0 && "can't implicitly cast lvalue to rvalue with this cast kind");
+ llvm_unreachable("can't implicitly cast lvalue to rvalue with this cast "
+ "kind");
case CK_LValueToRValue:
case CK_ArrayToPointerDecay:
case CK_FunctionToPointerDecay:
Modified: cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp?rev=211143&r1=211142&r2=211143&view=diff
==============================================================================
--- cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp (original)
+++ cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp Wed Jun 18 00:13:13 2014
@@ -1671,8 +1671,7 @@ void EmitClangAttrPCHRead(RecordKeeper &
OS << " switch (Kind) {\n";
OS << " default:\n";
- OS << " assert(0 && \"Unknown attribute!\");\n";
- OS << " break;\n";
+ OS << " llvm_unreachable(\"Unknown attribute!\");\n";
for (const auto *Attr : Attrs) {
const Record &R = *Attr;
if (!R.getValueAsBit("ASTNode"))
More information about the cfe-commits
mailing list