mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-04 17:11:44 +03:00
Handle new special vtbl symbol
There's a new need to access a class' vtable symbol, see dlang/dmd#8362. Use it as alias to the actual vtable symbol with different type (dummy: `i8*`, actual: `[N x i8*]`) and mangled name. I tried matching the special symbol's mangled name and using an appropriate static array front-end type for it, but then casting the symbol address for the assignment leads to issues if the ctor is @safe. So I decided to handle it in DtoSymbolAddress(). Unfortunately, this seems not to solve the extern(C++) issues exposed by LDC self-compilation yet.
This commit is contained in:
parent
7548b2b89b
commit
ef1e655767
1 changed files with 8 additions and 0 deletions
|
@ -1574,6 +1574,14 @@ DValue *DtoSymbolAddress(Loc &loc, Type *type, Declaration *decl) {
|
||||||
}
|
}
|
||||||
return new DImValue(type, m);
|
return new DImValue(type, m);
|
||||||
}
|
}
|
||||||
|
// special vtbl symbol, used by LDC as alias to the actual vtbl (with
|
||||||
|
// different type and mangled name)
|
||||||
|
if (vd->isClassMember() && vd == vd->isClassMember()->vtblsym) {
|
||||||
|
Logger::println("vtbl symbol");
|
||||||
|
auto cd = vd->isClassMember();
|
||||||
|
return new DLValue(
|
||||||
|
type, DtoBitCast(getIrAggr(cd)->getVtblSymbol(), DtoPtrToType(type)));
|
||||||
|
}
|
||||||
// nested variable
|
// nested variable
|
||||||
if (vd->nestedrefs.dim) {
|
if (vd->nestedrefs.dim) {
|
||||||
Logger::println("nested variable");
|
Logger::println("nested variable");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue