Backport fix for issue #2357 (#2366)

Improve robustness for TypeInfos of speculative types by only eliding
their TypeInfo definition, not the declaration of the LL global
altogether.

`DtoTypeInfoOf()` expects the LL global to be created and otherwise
fails with an assertion or segfault (e.g., issue #2357). So now only
linker errors should result in case the TypeInfo definition is missing.

Also normalize the calls to `DtoTypeInfoOf()` and revise the following
pointer bitcasts, as the LL type of forward-declared TypeInfo globals
may be opaque.
This commit is contained in:
kinke 2017-10-18 20:47:09 +02:00 committed by GitHub
parent fa5f318d3a
commit d1b30d627c
8 changed files with 38 additions and 44 deletions

View file

@ -438,7 +438,7 @@ static LLConstant *build_offti_entry(ClassDeclaration *cd, VarDeclaration *vd) {
inits[0] = DtoConstSize_t(offset);
// TypeInfo ti;
inits[1] = DtoTypeInfoOf(vd->type, true);
inits[1] = DtoTypeInfoOf(vd->type);
// done
return llvm::ConstantStruct::get(inits);