summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExprAgg.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2011-04-12 22:02:02 +0000
committerJohn McCall <rjmccall@apple.com>2011-04-12 22:02:02 +0000
commit58989b7125a04be7a05d6ad7090a16ecda496481 (patch)
treef19398c9a07f1f3c3a42b32301bed5c39a06377d /clang/lib/CodeGen/CGExprAgg.cpp
parenta4e29a64d858b7b7132c4e5552131146239e16b2 (diff)
downloadbcm5719-llvm-58989b7125a04be7a05d6ad7090a16ecda496481.tar.gz
bcm5719-llvm-58989b7125a04be7a05d6ad7090a16ecda496481.zip
We can't emit an aggregate cast as its sub-expression in general just
because the result is ignored. The particular example here is with property l-values, but there could be all sorts of lovely casts that this isn't safe for. Sink the check into the one case that seems to actually be capable of honoring this. llvm-svn: 129397
Diffstat (limited to 'clang/lib/CodeGen/CGExprAgg.cpp')
-rw-r--r--clang/lib/CodeGen/CGExprAgg.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CGExprAgg.cpp b/clang/lib/CodeGen/CGExprAgg.cpp
index 177d0a4be78..4315915c166 100644
--- a/clang/lib/CodeGen/CGExprAgg.cpp
+++ b/clang/lib/CodeGen/CGExprAgg.cpp
@@ -249,11 +249,6 @@ void AggExprEmitter::VisitOpaqueValueExpr(OpaqueValueExpr *e) {
}
void AggExprEmitter::VisitCastExpr(CastExpr *E) {
- if (Dest.isIgnored() && E->getCastKind() != CK_Dynamic) {
- Visit(E->getSubExpr());
- return;
- }
-
switch (E->getCastKind()) {
case CK_Dynamic: {
assert(isa<CXXDynamicCastExpr>(E) && "CK_Dynamic without a dynamic_cast?");
@@ -270,6 +265,8 @@ void AggExprEmitter::VisitCastExpr(CastExpr *E) {
}
case CK_ToUnion: {
+ if (Dest.isIgnored()) break;
+
// GCC union extension
QualType Ty = E->getSubExpr()->getType();
QualType PtrTy = CGF.getContext().getPointerType(Ty);
OpenPOWER on IntegriCloud