Fixed #37 — ICE: llvm::GlobalVariable::setInitializer assert failed

This commit is contained in:
Alexey Prokhin
2011-12-06 13:55:01 +04:00
parent f8bf70ff7a
commit 8b50928636
3 changed files with 20 additions and 12 deletions

View File

@@ -153,10 +153,12 @@ void RTTIBuilder::finalize(LLType* type, LLValue* value)
assert(st);
// set struct body
std::vector<LLType*> types;
for (int i = 0, n = inits.size(); i < n; ++i)
types.push_back(inits[i]->getType());
st->setBody(types);
if (st->isOpaque()) {
std::vector<LLType*> types;
for (int i = 0, n = inits.size(); i < n; ++i)
types.push_back(inits[i]->getType());
st->setBody(types);
}
// create the inititalizer
LLConstant* tiInit = LLConstantStruct::get(st, inits);