mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-04-29 06:30:39 +03:00
Do not construct Ir-Types twice for the same type.
This is the same as in PR #1269. The Ir-Types may be initialized twice (due to pointers, forward references etc.). This commit fixes hopefully all instances of this problem, using the same approach in each factory function. This fixes issue #1112.
This commit is contained in:
parent
4aac6351d4
commit
6ca3d730ae
3 changed files with 21 additions and 11 deletions
|
@ -186,12 +186,16 @@ IrTypeArray *IrTypeArray::get(Type *dt) {
|
|||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
IrTypeVector::IrTypeVector(Type *dt) : IrType(dt, vector2llvm(dt)) {}
|
||||
IrTypeVector::IrTypeVector(Type *dt, llvm::Type *lt) : IrType(dt, lt) {}
|
||||
|
||||
IrTypeVector *IrTypeVector::get(Type *dt) {
|
||||
auto t = new IrTypeVector(dt);
|
||||
dt->ctype = t;
|
||||
return t;
|
||||
LLType *lt = vector2llvm(dt);
|
||||
// Could have already built the type as part of a struct forward reference,
|
||||
// just as for pointers and arrays.
|
||||
if (!dt->ctype) {
|
||||
dt->ctype = new IrTypeVector(dt, lt);
|
||||
}
|
||||
return dt->ctype->isVector();
|
||||
}
|
||||
|
||||
llvm::Type *IrTypeVector::vector2llvm(Type *dt) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue