mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-04-21 03:09:02 +02:00
WIP: port to llvm 3.0
This commit is contained in:
@@ -63,7 +63,7 @@ void RTTIBuilder::push_string(const char* str)
|
||||
|
||||
void RTTIBuilder::push_null_void_array()
|
||||
{
|
||||
const llvm::Type* T = DtoType(Type::tvoid->arrayOf());
|
||||
LLType* T = DtoType(Type::tvoid->arrayOf());
|
||||
inits.push_back(getNullValue(T));
|
||||
}
|
||||
|
||||
@@ -143,18 +143,30 @@ void RTTIBuilder::push_funcptr(FuncDeclaration* fd, Type* castto)
|
||||
|
||||
void RTTIBuilder::finalize(IrGlobal* tid)
|
||||
{
|
||||
// create the inititalizer
|
||||
LLConstant* tiInit = LLConstantStruct::get(gIR->context(), &inits[0], inits.size(), false);
|
||||
finalize(tid->type, tid->value);
|
||||
}
|
||||
|
||||
// refine global type
|
||||
llvm::cast<llvm::OpaqueType>(tid->type.get())->refineAbstractTypeTo(tiInit->getType());
|
||||
void RTTIBuilder::finalize(LLType* type, LLValue* value)
|
||||
{
|
||||
llvm::ArrayRef<LLConstant*> inits = llvm::makeArrayRef(this->inits);
|
||||
LLStructType *st = isaStruct(type);
|
||||
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);
|
||||
|
||||
// create the inititalizer
|
||||
LLConstant* tiInit = LLConstantStruct::get(st, inits);
|
||||
|
||||
// set the initializer
|
||||
isaGlobalVar(tid->value)->setInitializer(tiInit);
|
||||
isaGlobalVar(value)->setInitializer(tiInit);
|
||||
}
|
||||
|
||||
LLConstant* RTTIBuilder::get_constant()
|
||||
LLConstant* RTTIBuilder::get_constant(LLStructType *initType)
|
||||
{
|
||||
// just return the inititalizer
|
||||
return LLConstantStruct::get(gIR->context(), &inits[0], inits.size(), false);
|
||||
return LLConstantStruct::get(initType, inits);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user