aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExprScalar.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2010-09-24 17:30:16 +0000
committerFariborz Jahanian <fjahanian@apple.com>2010-09-24 17:30:16 +0000
commit745da3a5bb4ea35f93f50301e7fbbb7d78d3b6bb (patch)
treed2de835a949cf37da086500c49d5421662dea3c5 /lib/CodeGen/CGExprScalar.cpp
parent51c7a789b17d708617946d5f9fde0a2e4feaefd1 (diff)
Patch implements passing arrays to functions expecting
vla. Implements pr7827. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114737 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprScalar.cpp')
-rw-r--r--lib/CodeGen/CGExprScalar.cpp13
1 files changed, 2 insertions, 11 deletions
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp
index 055e3f7e67..73e94d1ece 100644
--- a/lib/CodeGen/CGExprScalar.cpp
+++ b/lib/CodeGen/CGExprScalar.cpp
@@ -209,17 +209,8 @@ public:
}
Value *VisitCastExpr(CastExpr *E) {
// Make sure to evaluate VLA bounds now so that we have them for later.
- if (E->getType()->isVariablyModifiedType()) {
- // Implicit cast of a null pointer to a vla type need not result in vla
- // size computation which is not always possible in any case (see pr7827).
- bool NeedSize = true;
- if (const ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(E))
- NeedSize =
- !ICE->getSubExpr()->isNullPointerConstant(CGF.getContext(),
- Expr::NPC_ValueDependentIsNull);
- if (NeedSize)
- CGF.EmitVLASize(E->getType());
- }
+ if (E->getType()->isVariablyModifiedType())
+ CGF.EmitVLASize(E->getType());
return EmitCastExpr(E);
}