summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-09-29 01:23:39 +0000
committerAnders Carlsson <andersca@mac.com>2009-09-29 01:23:39 +0000
commit1fb7ae9e3ca14afc6621f65d7a6b0909ddfa4a4d (patch)
treeb354a757bf5f0997073ec33ad814e8b02775a389 /clang/lib
parentd30d820dc437325a351f960afdc3a7beb6a42873 (diff)
downloadbcm5719-llvm-1fb7ae9e3ca14afc6621f65d7a6b0909ddfa4a4d.tar.gz
bcm5719-llvm-1fb7ae9e3ca14afc6621f65d7a6b0909ddfa4a4d.zip
Use a switch statement in VisitCastExpr.
llvm-svn: 83038
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/CodeGen/CGExprAgg.cpp28
1 files changed, 16 insertions, 12 deletions
diff --git a/clang/lib/CodeGen/CGExprAgg.cpp b/clang/lib/CodeGen/CGExprAgg.cpp
index e19fb0065fc..f710b036a64 100644
--- a/clang/lib/CodeGen/CGExprAgg.cpp
+++ b/clang/lib/CodeGen/CGExprAgg.cpp
@@ -174,27 +174,31 @@ void AggExprEmitter::EmitFinalDestCopy(const Expr *E, LValue Src, bool Ignore) {
//===----------------------------------------------------------------------===//
void AggExprEmitter::VisitCastExpr(CastExpr *E) {
- if (E->getCastKind() == CastExpr::CK_ToUnion) {
+ switch (E->getCastKind()) {
+ default: assert(0 && "Unhandled cast kind!");
+
+ case CastExpr::CK_ToUnion: {
// GCC union extension
QualType PtrTy =
- CGF.getContext().getPointerType(E->getSubExpr()->getType());
+ CGF.getContext().getPointerType(E->getSubExpr()->getType());
llvm::Value *CastPtr = Builder.CreateBitCast(DestPtr,
CGF.ConvertType(PtrTy));
EmitInitializationToLValue(E->getSubExpr(),
LValue::MakeAddr(CastPtr, Qualifiers()));
- return;
+ break;
}
// FIXME: Remove the CK_Unknown check here.
- assert((E->getCastKind() == CastExpr::CK_NoOp ||
- E->getCastKind() == CastExpr::CK_Unknown ||
- E->getCastKind() == CastExpr::CK_UserDefinedConversion ||
- E->getCastKind() == CastExpr::CK_ConstructorConversion) &&
- "Only no-op casts allowed!");
- assert(CGF.getContext().hasSameUnqualifiedType(E->getSubExpr()->getType(),
- E->getType()) &&
- "Implicit cast types must be compatible");
- Visit(E->getSubExpr());
+ case CastExpr::CK_Unknown:
+ case CastExpr::CK_NoOp:
+ case CastExpr::CK_UserDefinedConversion:
+ case CastExpr::CK_ConstructorConversion:
+ assert(CGF.getContext().hasSameUnqualifiedType(E->getSubExpr()->getType(),
+ E->getType()) &&
+ "Implicit cast types must be compatible");
+ Visit(E->getSubExpr());
+ break;
+ }
}
void AggExprEmitter::VisitCallExpr(const CallExpr *E) {
OpenPOWER on IntegriCloud