mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-11 18:33:14 +01:00
Prefer C++-style casts.
This is based on Item 2 of "More Effective C++". In general, the C++ cast operators are more expressive and easy to find, e.g. by grep. Using const_cast also shuts up some compiler warnings.
This commit is contained in:
@@ -259,7 +259,7 @@ llvm::Module* Module::genLLVMModule(llvm::LLVMContext& context, Ir* sir)
|
||||
|
||||
// process module members
|
||||
for (unsigned k=0; k < members->dim; k++) {
|
||||
Dsymbol* dsym = (Dsymbol*)(members->data[k]);
|
||||
Dsymbol* dsym = static_cast<Dsymbol*>(members->data[k]);
|
||||
assert(dsym);
|
||||
dsym->codegen(sir);
|
||||
}
|
||||
@@ -377,7 +377,7 @@ void Module::genmoduleinfo()
|
||||
llvm::ArrayType* importedModulesTy = 0;
|
||||
for (size_t i = 0; i < aimports.dim; i++)
|
||||
{
|
||||
Module *m = (Module *)aimports.data[i];
|
||||
Module *m = static_cast<Module *>(aimports.data[i]);
|
||||
if (!m->needModuleInfo() || m == this)
|
||||
continue;
|
||||
|
||||
@@ -405,7 +405,7 @@ void Module::genmoduleinfo()
|
||||
{
|
||||
Dsymbol *member;
|
||||
|
||||
member = (Dsymbol *)members->data[i];
|
||||
member = static_cast<Dsymbol *>(members->data[i]);
|
||||
//printf("\tmember '%s'\n", member->toChars());
|
||||
member->addLocalClass(&aclasses);
|
||||
}
|
||||
@@ -413,7 +413,7 @@ void Module::genmoduleinfo()
|
||||
std::vector<LLConstant*> classInits;
|
||||
for (size_t i = 0; i < aclasses.dim; i++)
|
||||
{
|
||||
ClassDeclaration* cd = (ClassDeclaration*)aclasses.data[i];
|
||||
ClassDeclaration* cd = static_cast<ClassDeclaration*>(aclasses.data[i]);
|
||||
cd->codegen(Type::sir);
|
||||
|
||||
if (cd->isInterfaceDeclaration())
|
||||
|
||||
Reference in New Issue
Block a user