summaryrefslogtreecommitdiffstats
path: root/clang/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-12-17 05:17:42 +0000
committerChris Lattner <sabre@nondot.org>2007-12-17 05:17:42 +0000
commit28c91c5f3519317754f593cffa119be258ce85c1 (patch)
treee320c14644b5ee7e2500388f6ea0d7b5eb850f08 /clang/CodeGen/CodeGenModule.cpp
parent083bb46370a3d2a9e0d6159c5de3647e984274ca (diff)
downloadbcm5719-llvm-28c91c5f3519317754f593cffa119be258ce85c1.tar.gz
bcm5719-llvm-28c91c5f3519317754f593cffa119be258ce85c1.zip
add a hack so that codegen doesn't abort on missing sema of initializers, now
we emit stuff like this: abort on missing sema of initializers, now we emit stuff like this: t3.c:1:24: warning: cannot codegen this initializer yet const char x[2][4] = { { 'a', 'b', '\0', '\0' }, { 'c', 'd', 'e', '\0' } }; ^~~~~~~~~~~~~~~~~~~~~~~~ This should be removed when sema is finished. llvm-svn: 45086
Diffstat (limited to 'clang/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/CodeGen/CodeGenModule.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/clang/CodeGen/CodeGenModule.cpp b/clang/CodeGen/CodeGenModule.cpp
index ea908d398c9..76bf40353ae 100644
--- a/clang/CodeGen/CodeGenModule.cpp
+++ b/clang/CodeGen/CodeGenModule.cpp
@@ -281,7 +281,15 @@ static llvm::Constant *GenerateConstantCast(const Expr *Expression,
/// struct typed variables.
static llvm::Constant *GenerateAggregateInit(const InitListExpr *ILE,
CodeGenModule &CGM) {
- assert (ILE->getType()->isArrayType() || ILE->getType()->isStructureType());
+ if (ILE->getType()->isVoidType()) {
+ // FIXME: Remove this when sema of initializers is finished (and the code
+ // below).
+ CGM.WarnUnsupported(ILE, "initializer");
+ return 0;
+ }
+
+ assert((ILE->getType()->isArrayType() || ILE->getType()->isStructureType()) &&
+ "Bad type for init list!");
CodeGenTypes& Types = CGM.getTypes();
unsigned NumInitElements = ILE->getNumInits();
@@ -309,6 +317,12 @@ static llvm::Constant *GenerateAggregateInit(const InitListExpr *ILE,
unsigned i = 0;
for (i = 0; i < NumInitableElts; ++i) {
llvm::Constant *C = GenerateConstantExpr(ILE->getInit(i), CGM);
+ // FIXME: Remove this when sema of initializers is finished (and the code
+ // above).
+ if (C == 0 && ILE->getInit(i)->getType()->isVoidType()) {
+ if (ILE->getType()->isVoidType()) return 0;
+ return llvm::UndefValue::get(CType);
+ }
assert (C && "Failed to create initialiser expression");
Elts.push_back(C);
}
OpenPOWER on IntegriCloud