mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-02-26 08:33:14 +01:00
Renamed !TypeInfoBuilder to !RTTIBuilder.
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
|
||||
#include "ir/irstruct.h"
|
||||
|
||||
TypeInfoBuilder::TypeInfoBuilder(ClassDeclaration* base_class)
|
||||
RTTIBuilder::RTTIBuilder(ClassDeclaration* base_class)
|
||||
{
|
||||
// make sure the base typeinfo class has been processed
|
||||
base_class->codegen(Type::sir);
|
||||
@@ -29,38 +29,38 @@ TypeInfoBuilder::TypeInfoBuilder(ClassDeclaration* base_class)
|
||||
push_null_vp();
|
||||
}
|
||||
|
||||
void TypeInfoBuilder::push(llvm::Constant* C)
|
||||
void RTTIBuilder::push(llvm::Constant* C)
|
||||
{
|
||||
inits.push_back(C);
|
||||
}
|
||||
|
||||
void TypeInfoBuilder::push_null_vp()
|
||||
void RTTIBuilder::push_null_vp()
|
||||
{
|
||||
inits.push_back(getNullValue(getVoidPtrType()));
|
||||
}
|
||||
|
||||
void TypeInfoBuilder::push_typeinfo(Type* t)
|
||||
void RTTIBuilder::push_typeinfo(Type* t)
|
||||
{
|
||||
inits.push_back(DtoTypeInfoOf(t, true));
|
||||
}
|
||||
|
||||
void TypeInfoBuilder::push_classinfo(ClassDeclaration* cd)
|
||||
void RTTIBuilder::push_classinfo(ClassDeclaration* cd)
|
||||
{
|
||||
inits.push_back(cd->ir.irStruct->getClassInfoSymbol());
|
||||
}
|
||||
|
||||
void TypeInfoBuilder::push_string(const char* str)
|
||||
void RTTIBuilder::push_string(const char* str)
|
||||
{
|
||||
inits.push_back(DtoConstString(str));
|
||||
}
|
||||
|
||||
void TypeInfoBuilder::push_null_void_array()
|
||||
void RTTIBuilder::push_null_void_array()
|
||||
{
|
||||
const llvm::Type* T = DtoType(Type::tvoid->arrayOf());
|
||||
inits.push_back(getNullValue(T));
|
||||
}
|
||||
|
||||
void TypeInfoBuilder::push_void_array(uint64_t dim, llvm::Constant* ptr)
|
||||
void RTTIBuilder::push_void_array(uint64_t dim, llvm::Constant* ptr)
|
||||
{
|
||||
inits.push_back(DtoConstSlice(
|
||||
DtoConstSize_t(dim),
|
||||
@@ -68,7 +68,7 @@ void TypeInfoBuilder::push_void_array(uint64_t dim, llvm::Constant* ptr)
|
||||
));
|
||||
}
|
||||
|
||||
void TypeInfoBuilder::push_void_array(llvm::Constant* CI, Type* valtype, Dsymbol* mangle_sym)
|
||||
void RTTIBuilder::push_void_array(llvm::Constant* CI, Type* valtype, Dsymbol* mangle_sym)
|
||||
{
|
||||
std::string initname(mangle_sym->mangle());
|
||||
initname.append(".rtti.void[].data");
|
||||
@@ -83,7 +83,7 @@ void TypeInfoBuilder::push_void_array(llvm::Constant* CI, Type* valtype, Dsymbol
|
||||
push_void_array(dim, G);
|
||||
}
|
||||
|
||||
void TypeInfoBuilder::push_array(llvm::Constant * CI, uint64_t dim, Type* valtype, Dsymbol * mangle_sym)
|
||||
void RTTIBuilder::push_array(llvm::Constant * CI, uint64_t dim, Type* valtype, Dsymbol * mangle_sym)
|
||||
{
|
||||
std::string initname(mangle_sym?mangle_sym->mangle():".ldc");
|
||||
initname.append(".rtti.");
|
||||
@@ -100,17 +100,17 @@ void TypeInfoBuilder::push_array(llvm::Constant * CI, uint64_t dim, Type* valtyp
|
||||
));
|
||||
}
|
||||
|
||||
void TypeInfoBuilder::push_uint(unsigned u)
|
||||
void RTTIBuilder::push_uint(unsigned u)
|
||||
{
|
||||
inits.push_back(DtoConstUint(u));
|
||||
}
|
||||
|
||||
void TypeInfoBuilder::push_size(uint64_t s)
|
||||
void RTTIBuilder::push_size(uint64_t s)
|
||||
{
|
||||
inits.push_back(DtoConstSize_t(s));
|
||||
}
|
||||
|
||||
void TypeInfoBuilder::push_funcptr(FuncDeclaration* fd)
|
||||
void RTTIBuilder::push_funcptr(FuncDeclaration* fd)
|
||||
{
|
||||
if (fd)
|
||||
{
|
||||
@@ -124,7 +124,7 @@ void TypeInfoBuilder::push_funcptr(FuncDeclaration* fd)
|
||||
}
|
||||
}
|
||||
|
||||
void TypeInfoBuilder::finalize(IrGlobal* tid)
|
||||
void RTTIBuilder::finalize(IrGlobal* tid)
|
||||
{
|
||||
// create the inititalizer
|
||||
LLConstant* tiInit = llvm::ConstantStruct::get(&inits[0], inits.size(), false);
|
||||
|
||||
@@ -10,7 +10,7 @@ struct Type;
|
||||
|
||||
struct IrStruct;
|
||||
|
||||
struct TypeInfoBuilder
|
||||
struct RTTIBuilder
|
||||
{
|
||||
ClassDeclaration* base;
|
||||
TypeClass* basetype;
|
||||
@@ -19,7 +19,7 @@ struct TypeInfoBuilder
|
||||
// 10 is enough for any D1 typeinfo
|
||||
llvm::SmallVector<llvm::Constant*, 10> inits;
|
||||
|
||||
TypeInfoBuilder(ClassDeclaration* base_class);
|
||||
RTTIBuilder(ClassDeclaration* base_class);
|
||||
|
||||
void push(llvm::Constant* C);
|
||||
void push_null_vp();
|
||||
|
||||
@@ -373,7 +373,7 @@ void TypeInfoTypedefDeclaration::llvmDefine()
|
||||
Logger::println("TypeInfoTypedefDeclaration::llvmDefine() %s", toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
TypeInfoBuilder b(Type::typeinfotypedef);
|
||||
RTTIBuilder b(Type::typeinfotypedef);
|
||||
|
||||
assert(tinfo->ty == Ttypedef);
|
||||
TypeTypedef *tc = (TypeTypedef *)tinfo;
|
||||
@@ -411,7 +411,7 @@ void TypeInfoEnumDeclaration::llvmDefine()
|
||||
Logger::println("TypeInfoEnumDeclaration::llvmDefine() %s", toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
TypeInfoBuilder b(Type::typeinfoenum);
|
||||
RTTIBuilder b(Type::typeinfoenum);
|
||||
|
||||
assert(tinfo->ty == Tenum);
|
||||
TypeEnum *tc = (TypeEnum *)tinfo;
|
||||
@@ -449,7 +449,7 @@ void TypeInfoPointerDeclaration::llvmDefine()
|
||||
Logger::println("TypeInfoPointerDeclaration::llvmDefine() %s", toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
TypeInfoBuilder b(Type::typeinfopointer);
|
||||
RTTIBuilder b(Type::typeinfopointer);
|
||||
// TypeInfo base
|
||||
b.push_typeinfo(tinfo->nextOf());
|
||||
// finish
|
||||
@@ -463,7 +463,7 @@ void TypeInfoArrayDeclaration::llvmDefine()
|
||||
Logger::println("TypeInfoArrayDeclaration::llvmDefine() %s", toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
TypeInfoBuilder b(Type::typeinfoarray);
|
||||
RTTIBuilder b(Type::typeinfoarray);
|
||||
// TypeInfo base
|
||||
b.push_typeinfo(tinfo->nextOf());
|
||||
// finish
|
||||
@@ -480,7 +480,7 @@ void TypeInfoStaticArrayDeclaration::llvmDefine()
|
||||
assert(tinfo->ty == Tsarray);
|
||||
TypeSArray *tc = (TypeSArray *)tinfo;
|
||||
|
||||
TypeInfoBuilder b(Type::typeinfostaticarray);
|
||||
RTTIBuilder b(Type::typeinfostaticarray);
|
||||
|
||||
// value typeinfo
|
||||
b.push_typeinfo(tc->nextOf());
|
||||
@@ -502,7 +502,7 @@ void TypeInfoAssociativeArrayDeclaration::llvmDefine()
|
||||
assert(tinfo->ty == Taarray);
|
||||
TypeAArray *tc = (TypeAArray *)tinfo;
|
||||
|
||||
TypeInfoBuilder b(Type::typeinfoassociativearray);
|
||||
RTTIBuilder b(Type::typeinfoassociativearray);
|
||||
|
||||
// value typeinfo
|
||||
b.push_typeinfo(tc->nextOf());
|
||||
@@ -521,7 +521,7 @@ void TypeInfoFunctionDeclaration::llvmDefine()
|
||||
Logger::println("TypeInfoFunctionDeclaration::llvmDefine() %s", toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
TypeInfoBuilder b(Type::typeinfofunction);
|
||||
RTTIBuilder b(Type::typeinfofunction);
|
||||
// TypeInfo base
|
||||
b.push_typeinfo(tinfo->nextOf());
|
||||
// finish
|
||||
@@ -538,7 +538,7 @@ void TypeInfoDelegateDeclaration::llvmDefine()
|
||||
assert(tinfo->ty == Tdelegate);
|
||||
Type* ret_type = tinfo->nextOf()->nextOf();
|
||||
|
||||
TypeInfoBuilder b(Type::typeinfodelegate);
|
||||
RTTIBuilder b(Type::typeinfodelegate);
|
||||
// TypeInfo base
|
||||
b.push_typeinfo(ret_type);
|
||||
// finish
|
||||
@@ -582,7 +582,7 @@ void TypeInfoStructDeclaration::llvmDefine()
|
||||
sd->codegen(Type::sir);
|
||||
IrStruct* irstruct = sd->ir.irStruct;
|
||||
|
||||
TypeInfoBuilder b(Type::typeinfostruct);
|
||||
RTTIBuilder b(Type::typeinfostruct);
|
||||
|
||||
// char[] name
|
||||
b.push_string(sd->toPrettyChars());
|
||||
@@ -670,7 +670,7 @@ void TypeInfoClassDeclaration::llvmDefine()
|
||||
TypeClass *tc = (TypeClass *)tinfo;
|
||||
tc->sym->codegen(Type::sir);
|
||||
|
||||
TypeInfoBuilder b(Type::typeinfoclass);
|
||||
RTTIBuilder b(Type::typeinfoclass);
|
||||
|
||||
// TypeInfo base
|
||||
b.push_classinfo(tc->sym);
|
||||
@@ -691,7 +691,7 @@ void TypeInfoInterfaceDeclaration::llvmDefine()
|
||||
TypeClass *tc = (TypeClass *)tinfo;
|
||||
tc->sym->codegen(Type::sir);
|
||||
|
||||
TypeInfoBuilder b(Type::typeinfointerface);
|
||||
RTTIBuilder b(Type::typeinfointerface);
|
||||
|
||||
// TypeInfo base
|
||||
b.push_classinfo(tc->sym);
|
||||
@@ -727,7 +727,7 @@ void TypeInfoTupleDeclaration::llvmDefine()
|
||||
const LLArrayType* arrTy = LLArrayType::get(tiTy, dim);
|
||||
LLConstant* arrC = llvm::ConstantArray::get(arrTy, arrInits);
|
||||
|
||||
TypeInfoBuilder b(Type::typeinfotypelist);
|
||||
RTTIBuilder b(Type::typeinfotypelist);
|
||||
|
||||
// push TypeInfo[]
|
||||
b.push_array(arrC, dim, Type::typeinfo->type, NULL);
|
||||
@@ -745,7 +745,7 @@ void TypeInfoConstDeclaration::llvmDefine()
|
||||
Logger::println("TypeInfoConstDeclaration::llvmDefine() %s", toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
TypeInfoBuilder b(Type::typeinfoconst);
|
||||
RTTIBuilder b(Type::typeinfoconst);
|
||||
// TypeInfo base
|
||||
b.push_typeinfo(tinfo->mutableOf()->merge());
|
||||
// finish
|
||||
@@ -759,7 +759,7 @@ void TypeInfoInvariantDeclaration::llvmDefine()
|
||||
Logger::println("TypeInfoInvariantDeclaration::llvmDefine() %s", toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
TypeInfoBuilder b(Type::typeinfoinvariant);
|
||||
RTTIBuilder b(Type::typeinfoinvariant);
|
||||
// TypeInfo base
|
||||
b.push_typeinfo(tinfo->mutableOf()->merge());
|
||||
// finish
|
||||
|
||||
Reference in New Issue
Block a user