mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-03 00:20:40 +03:00
Get rid of special 'typeid(...)' LL types for TypeInfos
Use the real LL type representing the TypeInfo (sub)class directly and from the beginning, i.e., already for the declaration, instead of building an extra LL struct type (firstly opaque, then finalized when defining the TypeInfo via RTTIBuilder). To get this to work in all cases, the dummy TypeInfo for opaque structs is now a complete TypeInfo_Struct, with all 11/13 fields zero- initialized. Previously, it was a special TypeInfo (no extra TypeInfo_Struct fields) with TypeInfo_Struct vtable, something which DMD also emits. Also refactor the RTTIBuilder finalize() interface - e.g., don't set the linkage there (had to be reverted for ModuleInfos) and only take the global variable to be defined. Cast the field initializers if required, e.g., null pointers to appropriately typed function pointers for TypeInfo_Struct etc.
This commit is contained in:
parent
3d0a127d96
commit
3f38f9715a
5 changed files with 97 additions and 76 deletions
|
@ -310,7 +310,6 @@ llvm::GlobalVariable *genModuleInfo(Module *m) {
|
|||
|
||||
// Create a global symbol with the above initialiser.
|
||||
LLGlobalVariable *moduleInfoSym = getIrModule(m)->moduleInfoSymbol();
|
||||
b.finalize(moduleInfoSym->getType()->getPointerElementType(), moduleInfoSym);
|
||||
setLinkage({LLGlobalValue::ExternalLinkage, false}, moduleInfoSym);
|
||||
b.finalize(moduleInfoSym);
|
||||
return moduleInfoSym;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue