mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-05 01:20:51 +03:00
LLVM 3.7: llvm::GetElementPtrInst() requires the pointed-to type.
Currently, the pointer type is passed which causes an assertion. Also add assertion to verify that parameter ptr is really of a pointer type.
This commit is contained in:
parent
a473a2aa2c
commit
c0e23d6814
1 changed files with 12 additions and 4 deletions
|
@ -307,9 +307,11 @@ LLIntegerType* DtoSize_t()
|
||||||
|
|
||||||
LLValue* DtoGEP1(LLValue* ptr, LLValue* i0, const char* var, llvm::BasicBlock* bb)
|
LLValue* DtoGEP1(LLValue* ptr, LLValue* i0, const char* var, llvm::BasicBlock* bb)
|
||||||
{
|
{
|
||||||
|
LLPointerType* p = isaPointer(ptr);
|
||||||
|
assert(p && "GEP expects a pointer type");
|
||||||
return llvm::GetElementPtrInst::Create(
|
return llvm::GetElementPtrInst::Create(
|
||||||
#if LDC_LLVM_VER >= 307
|
#if LDC_LLVM_VER >= 307
|
||||||
ptr->getType(),
|
p->getElementType(),
|
||||||
#endif
|
#endif
|
||||||
ptr, i0, var, bb ? bb : gIR->scopebb());
|
ptr, i0, var, bb ? bb : gIR->scopebb());
|
||||||
}
|
}
|
||||||
|
@ -318,10 +320,12 @@ LLValue* DtoGEP1(LLValue* ptr, LLValue* i0, const char* var, llvm::BasicBlock* b
|
||||||
|
|
||||||
LLValue* DtoGEP(LLValue* ptr, LLValue* i0, LLValue* i1, const char* var, llvm::BasicBlock* bb)
|
LLValue* DtoGEP(LLValue* ptr, LLValue* i0, LLValue* i1, const char* var, llvm::BasicBlock* bb)
|
||||||
{
|
{
|
||||||
|
LLPointerType* p = isaPointer(ptr);
|
||||||
|
assert(p && "GEP expects a pointer type");
|
||||||
LLValue* v[] = { i0, i1 };
|
LLValue* v[] = { i0, i1 };
|
||||||
return llvm::GetElementPtrInst::Create(
|
return llvm::GetElementPtrInst::Create(
|
||||||
#if LDC_LLVM_VER >= 307
|
#if LDC_LLVM_VER >= 307
|
||||||
ptr->getType(),
|
p->getElementType(),
|
||||||
#endif
|
#endif
|
||||||
ptr, v, var, bb ? bb : gIR->scopebb());
|
ptr, v, var, bb ? bb : gIR->scopebb());
|
||||||
}
|
}
|
||||||
|
@ -330,9 +334,11 @@ LLValue* DtoGEP(LLValue* ptr, LLValue* i0, LLValue* i1, const char* var, llvm::B
|
||||||
|
|
||||||
LLValue* DtoGEPi1(LLValue* ptr, unsigned i, const char* var, llvm::BasicBlock* bb)
|
LLValue* DtoGEPi1(LLValue* ptr, unsigned i, const char* var, llvm::BasicBlock* bb)
|
||||||
{
|
{
|
||||||
|
LLPointerType* p = isaPointer(ptr);
|
||||||
|
assert(p && "GEP expects a pointer type");
|
||||||
return llvm::GetElementPtrInst::Create(
|
return llvm::GetElementPtrInst::Create(
|
||||||
#if LDC_LLVM_VER >= 307
|
#if LDC_LLVM_VER >= 307
|
||||||
ptr->getType(),
|
p->getElementType(),
|
||||||
#endif
|
#endif
|
||||||
ptr, DtoConstUint(i), var, bb ? bb : gIR->scopebb());
|
ptr, DtoConstUint(i), var, bb ? bb : gIR->scopebb());
|
||||||
}
|
}
|
||||||
|
@ -341,10 +347,12 @@ LLValue* DtoGEPi1(LLValue* ptr, unsigned i, const char* var, llvm::BasicBlock* b
|
||||||
|
|
||||||
LLValue* DtoGEPi(LLValue* ptr, unsigned i0, unsigned i1, const char* var, llvm::BasicBlock* bb)
|
LLValue* DtoGEPi(LLValue* ptr, unsigned i0, unsigned i1, const char* var, llvm::BasicBlock* bb)
|
||||||
{
|
{
|
||||||
|
LLPointerType* p = isaPointer(ptr);
|
||||||
|
assert(p && "GEP expects a pointer type");
|
||||||
LLValue* v[] = { DtoConstUint(i0), DtoConstUint(i1) };
|
LLValue* v[] = { DtoConstUint(i0), DtoConstUint(i1) };
|
||||||
return llvm::GetElementPtrInst::Create(
|
return llvm::GetElementPtrInst::Create(
|
||||||
#if LDC_LLVM_VER >= 307
|
#if LDC_LLVM_VER >= 307
|
||||||
ptr->getType(),
|
p->getElementType(),
|
||||||
#endif
|
#endif
|
||||||
ptr, v, var, bb ? bb : gIR->scopebb());
|
ptr, v, var, bb ? bb : gIR->scopebb());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue