mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-01 23:50:43 +03:00
driver/gen/ir: clang-format the world
This uses the LLVM style, which makes sense for sharing code with other LLVM projects. The DMD code we use will soon all be in D anyway.
This commit is contained in:
parent
123666cf89
commit
44b0f7b615
125 changed files with 28991 additions and 30602 deletions
|
@ -16,44 +16,38 @@
|
|||
|
||||
#include "ir/irtypefunction.h"
|
||||
|
||||
IrTypeFunction::IrTypeFunction(Type* dt, llvm::Type* lt, const IrFuncTy& irFty_)
|
||||
: IrType(dt, lt), irFty(irFty_)
|
||||
{
|
||||
}
|
||||
IrTypeFunction::IrTypeFunction(Type *dt, llvm::Type *lt, const IrFuncTy &irFty_)
|
||||
: IrType(dt, lt), irFty(irFty_) {}
|
||||
|
||||
IrTypeFunction* IrTypeFunction::get(Type* dt)
|
||||
{
|
||||
assert(!dt->ctype);
|
||||
assert(dt->ty == Tfunction);
|
||||
IrTypeFunction *IrTypeFunction::get(Type *dt) {
|
||||
assert(!dt->ctype);
|
||||
assert(dt->ty == Tfunction);
|
||||
|
||||
IrFuncTy irFty;
|
||||
llvm::Type* lt = DtoFunctionType(dt, irFty, NULL, NULL);
|
||||
IrFuncTy irFty;
|
||||
llvm::Type *lt = DtoFunctionType(dt, irFty, NULL, NULL);
|
||||
|
||||
IrTypeFunction* result = new IrTypeFunction(dt, lt, irFty);
|
||||
dt->ctype = result;
|
||||
return result;
|
||||
IrTypeFunction *result = new IrTypeFunction(dt, lt, irFty);
|
||||
dt->ctype = result;
|
||||
return result;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
IrTypeDelegate::IrTypeDelegate(Type* dt, llvm::Type* lt, const IrFuncTy& irFty_)
|
||||
: IrType(dt, lt), irFty(irFty_)
|
||||
{
|
||||
}
|
||||
|
||||
IrTypeDelegate* IrTypeDelegate::get(Type* t)
|
||||
{
|
||||
assert(!t->ctype);
|
||||
assert(t->ty == Tdelegate);
|
||||
assert(t->nextOf()->ty == Tfunction);
|
||||
|
||||
IrFuncTy irFty;
|
||||
llvm::Type* ltf = DtoFunctionType(t->nextOf(), irFty, NULL,
|
||||
Type::tvoid->pointerTo());
|
||||
llvm::Type *types[] = { getVoidPtrType(), getPtrToType(ltf) };
|
||||
LLStructType* lt = LLStructType::get(gIR->context(), types, false);
|
||||
|
||||
IrTypeDelegate* result = new IrTypeDelegate(t, lt, irFty);
|
||||
t->ctype = result;
|
||||
return result;
|
||||
IrTypeDelegate::IrTypeDelegate(Type *dt, llvm::Type *lt, const IrFuncTy &irFty_)
|
||||
: IrType(dt, lt), irFty(irFty_) {}
|
||||
|
||||
IrTypeDelegate *IrTypeDelegate::get(Type *t) {
|
||||
assert(!t->ctype);
|
||||
assert(t->ty == Tdelegate);
|
||||
assert(t->nextOf()->ty == Tfunction);
|
||||
|
||||
IrFuncTy irFty;
|
||||
llvm::Type *ltf =
|
||||
DtoFunctionType(t->nextOf(), irFty, NULL, Type::tvoid->pointerTo());
|
||||
llvm::Type *types[] = {getVoidPtrType(), getPtrToType(ltf)};
|
||||
LLStructType *lt = LLStructType::get(gIR->context(), types, false);
|
||||
|
||||
IrTypeDelegate *result = new IrTypeDelegate(t, lt, irFty);
|
||||
t->ctype = result;
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue