Code gen static initializer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43386 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/CodeGen/CGDecl.cpp b/CodeGen/CGDecl.cpp
index 75a3285..09a47b9 100644
--- a/CodeGen/CGDecl.cpp
+++ b/CodeGen/CGDecl.cpp
@@ -75,9 +75,14 @@
llvm::Constant *Init = 0;
if (D.getInit() == 0) {
Init = llvm::Constant::getNullValue(LTy);
- } else
- assert(0 && "FIXME: Support initializers");
-
+ } else if (D.getType()->isIntegerType()) {
+ llvm::APSInt Value(static_cast<uint32_t>(
+ getContext().getTypeSize(D.getInit()->getType(), SourceLocation())));
+ if (D.getInit()->isIntegerConstantExpr(Value, getContext()))
+ Init = llvm::ConstantInt::get(Value);
+ }
+
+ assert(Init && "FIXME: Support initializers");
DMEntry =
new llvm::GlobalVariable(LTy, false,