diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2010-06-29 00:23:11 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2010-06-29 00:23:11 +0000 |
commit | 0010bca8afaed0236c4910640f6bc1bcf1984125 (patch) | |
tree | b952b8e195a630a787da874e0052a30234105ac0 /lib/AST/ExprClassification.cpp | |
parent | 225e286110bcc8b7b1ff8b35f0d51a10a158b18c (diff) |
Prefer llvm_unreachable(...) to assert(false && ...). This is important as
without it we might exit a non-void function without returning.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107106 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ExprClassification.cpp')
-rw-r--r-- | lib/AST/ExprClassification.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/AST/ExprClassification.cpp b/lib/AST/ExprClassification.cpp index 608706bdb0..4629500848 100644 --- a/lib/AST/ExprClassification.cpp +++ b/lib/AST/ExprClassification.cpp @@ -11,6 +11,7 @@ // //===----------------------------------------------------------------------===// +#include "llvm/Support/ErrorHandling.h" #include "clang/AST/Expr.h" #include "clang/AST/ExprCXX.h" #include "clang/AST/ExprObjC.h" @@ -432,7 +433,7 @@ Expr::isLvalueResult Expr::isLvalue(ASTContext &Ctx) const { case Cl::CL_ClassTemporary: return LV_ClassTemporary; case Cl::CL_PRValue: return LV_InvalidExpression; } - assert(false && "Unhandled kind"); + llvm_unreachable("Unhandled kind"); } Expr::isModifiableLvalueResult @@ -454,17 +455,17 @@ Expr::isModifiableLvalue(ASTContext &Ctx, SourceLocation *Loc) const { } assert(VC.getKind() == Cl::CL_LValue && "Unhandled kind"); switch (VC.getModifiable()) { - case Cl::CM_Untested: assert(false && "Did not test modifiability"); + case Cl::CM_Untested: llvm_unreachable("Did not test modifiability"); case Cl::CM_Modifiable: return MLV_Valid; - case Cl::CM_RValue: assert(false && "CM_RValue and CL_LValue don't match"); + case Cl::CM_RValue: llvm_unreachable("CM_RValue and CL_LValue don't match"); case Cl::CM_Function: return MLV_NotObjectType; case Cl::CM_LValueCast: - assert(false && "CM_LValueCast and CL_LValue don't match"); + llvm_unreachable("CM_LValueCast and CL_LValue don't match"); case Cl::CM_NotBlockQualified: return MLV_NotBlockQualified; case Cl::CM_NoSetterProperty: return MLV_NoSetterProperty; case Cl::CM_ConstQualified: return MLV_ConstQualified; case Cl::CM_ArrayType: return MLV_ArrayType; case Cl::CM_IncompleteType: return MLV_IncompleteType; } - assert(false && "Unhandled modifiable type"); + llvm_unreachable("Unhandled modifiable type"); } |