diff options
author | Devang Patel <dpatel@apple.com> | 2007-10-24 17:18:43 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2007-10-24 17:18:43 +0000 |
commit | 35634f5ed67966c9f1fde38420e79cc6515cd673 (patch) | |
tree | e1a3e2f17d61bb1233f3e83a4e44f55cf25e94c6 | |
parent | f04da137288c48879a86e9e1d4014db8e28dbae1 (diff) |
Visit CompoundLiteralExpr and InitListExpr
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43300 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | CodeGen/CGExprScalar.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/CodeGen/CGExprScalar.cpp b/CodeGen/CGExprScalar.cpp index 012cb69c32..d23473a64c 100644 --- a/CodeGen/CGExprScalar.cpp +++ b/CodeGen/CGExprScalar.cpp @@ -119,8 +119,22 @@ public: Value *VisitOCUVectorElementExpr(Expr *E) { return EmitLoadOfLValue(E); } Value *VisitStringLiteral(Expr *E) { return EmitLValue(E).getAddress(); } Value *VisitPreDefinedExpr(Expr *E) { return EmitLValue(E).getAddress(); } - - // FIXME: CompoundLiteralExpr + + Value *VisitInitListExpr(InitListExpr *E) { + std::vector<llvm::Constant *> Elements; + unsigned N = E->getNumInits(); + for (unsigned i = 0; i < N; ++i) { + Value *V = Visit(E->getInit(i)); + llvm::Constant * C = cast<llvm::Constant>(V); + Elements.push_back(C); + } + return llvm::ConstantVector::get(Elements); + } + + Value *VisitCompoundLiteralExpr(CompoundLiteralExpr *E) { + return Visit(E->getInitializer()); + } + Value *VisitImplicitCastExpr(const ImplicitCastExpr *E); Value *VisitCastExpr(const CastExpr *E) { return EmitCastExpr(E->getSubExpr(), E->getType()); |