[cfe-commits] r43300 - /cfe/trunk/CodeGen/CGExprScalar.cpp
Devang Patel
dpatel at apple.com
Wed Oct 24 10:18:43 PDT 2007
Author: dpatel
Date: Wed Oct 24 12:18:43 2007
New Revision: 43300
URL: http://llvm.org/viewvc/llvm-project?rev=43300&view=rev
Log:
Visit CompoundLiteralExpr and InitListExpr
Modified:
cfe/trunk/CodeGen/CGExprScalar.cpp
Modified: cfe/trunk/CodeGen/CGExprScalar.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CGExprScalar.cpp?rev=43300&r1=43299&r2=43300&view=diff
==============================================================================
--- cfe/trunk/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/CodeGen/CGExprScalar.cpp Wed Oct 24 12:18:43 2007
@@ -119,8 +119,22 @@
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());
More information about the cfe-commits
mailing list