From 07eb733ef8b93d8af7e98c79b9c4c8026da0598e Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 12 Jul 2007 00:39:48 +0000 Subject: [PATCH] Evaluate the initializer for automatic variables. llvm-svn: 39771 --- clang/CodeGen/CGDecl.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/clang/CodeGen/CGDecl.cpp b/clang/CodeGen/CGDecl.cpp index 822aca3f557d..1cce124a8290 100644 --- a/clang/CodeGen/CGDecl.cpp +++ b/clang/CodeGen/CGDecl.cpp @@ -84,7 +84,9 @@ void CodeGenFunction::EmitLocalBlockVarDecl(const BlockVarDecl &D) { assert(DMEntry == 0 && "Decl already exists in localdeclmap!"); DMEntry = DeclPtr; - // FIXME: Evaluate initializer. + // If this local has an initializer, emit it now. + if (const Expr *Init = D.getInit()) + EmitStoreThroughLValue(EmitExpr(Init), LValue::MakeAddr(DeclPtr), Ty); } /// Emit an alloca for the specified parameter and set up LocalDeclMap.