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

@ -64,7 +64,7 @@ void RTTIBuilder::push_null(Type *T) { push(getNullValue(DtoType(T))); }
void RTTIBuilder::push_null_vp() { push(getNullValue(getVoidPtrType())); }
void RTTIBuilder::push_typeinfo(Type *t) { push(DtoTypeInfoOf(t, true)); }
void RTTIBuilder::push_typeinfo(Type *t) { push(DtoTypeInfoOf(t)); }
void RTTIBuilder::push_classinfo(ClassDeclaration *cd) {
push(getIrAggr(cd)->getClassInfoSymbol());