mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-02-08 16:03:13 +01:00
DMD Issue 5416 - null should have a type of its own
This commit is contained in:
@@ -137,7 +137,7 @@ llvm::Type * IrTypeBasic::basic2llvm(Type* t)
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
IrTypePointer::IrTypePointer(Type * dt)
|
||||
: IrType(dt, pointer2llvm(dt))
|
||||
: IrType(dt, dt->ty == Tnull ? null2llvm(dt) : pointer2llvm(dt))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -160,6 +160,13 @@ llvm::Type * IrTypePointer::pointer2llvm(Type * dt)
|
||||
return llvm::PointerType::get(elemType, 0);
|
||||
}
|
||||
|
||||
llvm::Type* IrTypePointer::null2llvm(Type* dt)
|
||||
{
|
||||
assert(dt->ty == Tnull && "not null type");
|
||||
LLType* elemType = llvm::Type::getInt8Ty(llvm::getGlobalContext());
|
||||
return llvm::PointerType::get(elemType, 0);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user