Avoid a few llvm::Type::getPointerElementType() usages

This commit is contained in:
Martin Kinkelin 2022-03-30 19:53:00 +02:00
parent 8527b3f9c8
commit e72c58d2c3
2 changed files with 2 additions and 3 deletions

View file

@ -144,7 +144,7 @@ void RTTIBuilder::push_funcptr(FuncDeclaration *fd, Type *castto) {
} }
void RTTIBuilder::finalize(LLGlobalVariable *gvar) { void RTTIBuilder::finalize(LLGlobalVariable *gvar) {
LLStructType *st = isaStruct(gvar->getType()->getPointerElementType()); LLStructType *st = isaStruct(gvar->getValueType());
assert(st); assert(st);
// finalize the type if opaque (e.g., for ModuleInfos) // finalize the type if opaque (e.g., for ModuleInfos)

View file

@ -76,8 +76,7 @@ LLConstant *IrAggr::getInitSymbol(bool define) {
assert(!initGlobal->hasInitializer() && assert(!initGlobal->hasInitializer() &&
"existing init symbol not expected to be defined"); "existing init symbol not expected to be defined");
assert((isBuiltinTypeInfo || assert((isBuiltinTypeInfo ||
initGlobal->getType()->getPointerElementType() == initGlobal->getValueType() == getLLStructType()) &&
getLLStructType()) &&
"type of existing init symbol declaration doesn't match"); "type of existing init symbol declaration doesn't match");
} else { } else {
// Init symbols of built-in TypeInfos need to be kept mutable as the type // Init symbols of built-in TypeInfos need to be kept mutable as the type