mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-02 16:11:08 +03:00
Use opaque [N x i8*] for vtables
This fixes the forward-referencing issue #1741.
This commit is contained in:
parent
e1394fad5f
commit
16d15e01cb
8 changed files with 46 additions and 131 deletions
|
@ -390,7 +390,6 @@ LLValue *DtoVirtualFunctionPointer(DValue *inst, FuncDeclaration *fdecl,
|
|||
|
||||
LLValue *funcval = vthis;
|
||||
// get the vtbl for objects
|
||||
stripModifiers(inst->type->toBasetype())->ctype->isClass()->getVtblType(true);
|
||||
funcval = DtoGEPi(funcval, 0, 0);
|
||||
// load vtbl ptr
|
||||
funcval = DtoLoad(funcval);
|
||||
|
@ -398,12 +397,12 @@ LLValue *DtoVirtualFunctionPointer(DValue *inst, FuncDeclaration *fdecl,
|
|||
std::string vtblname = name;
|
||||
vtblname.append("@vtbl");
|
||||
funcval = DtoGEPi(funcval, 0, fdecl->vtblIndex, vtblname.c_str());
|
||||
// load funcptr
|
||||
// load opaque pointer
|
||||
funcval = DtoAlignedLoad(funcval);
|
||||
|
||||
IF_LOG Logger::cout() << "funcval: " << *funcval << '\n';
|
||||
|
||||
// cast to final funcptr type
|
||||
// cast to funcptr type
|
||||
funcval = DtoBitCast(funcval, getPtrToType(DtoFunctionType(fdecl)));
|
||||
|
||||
// postpone naming until after casting to get the name in call instructions
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue