Adapt to free arrayOf(Type*) function

This commit is contained in:
Martin Kinkelin 2024-03-03 20:59:55 +01:00
parent 81cdec0f7a
commit bb2dec2f87
7 changed files with 14 additions and 13 deletions

View file

@ -259,7 +259,6 @@ public:
bool isSharedWild() const { return (mod & (MODshared | MODwild)) == (MODshared | MODwild); }
bool isNaked() const { return mod == 0; }
Type *nullAttributes() const;
Type *arrayOf();
Type *sarrayOf(dinteger_t dim);
bool hasDeprecatedAliasThis();
virtual Type *makeConst();

View file

@ -727,7 +727,7 @@ LLValue *DtoArrayEqCmp_impl(const Loc &loc, const char *func, DValue *l,
assert(fn);
// find common dynamic array type
Type *commonType = l->type->toBasetype()->nextOf()->arrayOf();
Type *commonType = arrayOf(l->type->toBasetype()->nextOf());
// cast static arrays to dynamic ones, this turns them into DSliceValues
Logger::println("casting to dynamic arrays");

View file

@ -181,7 +181,7 @@ llvm::FunctionType *DtoFunctionType(Type *type, IrFuncTy &irFty, Type *thistype,
if (isLLVMVariadic && f->linkage == LINK::d) {
// Add extra `_arguments` parameter for D-style variadic functions.
newIrFty.arg_arguments =
new IrFuncTyArg(getTypeInfoType()->arrayOf(), false);
new IrFuncTyArg(arrayOf(getTypeInfoType()), false);
++nextLLArgIdx;
}
@ -189,7 +189,7 @@ llvm::FunctionType *DtoFunctionType(Type *type, IrFuncTy &irFty, Type *thistype,
// if this _Dmain() doesn't have an argument, we force it to have one
if (isMain && f->linkage != LINK::c && numExplicitDArgs == 0) {
Type *mainargs = Type::tchar->arrayOf()->arrayOf();
Type *mainargs = arrayOf(arrayOf(Type::tchar));
newIrFty.args.push_back(new IrFuncTyArg(mainargs, false));
++nextLLArgIdx;
}

View file

@ -66,7 +66,7 @@ void RTTIBuilder::push_typeinfo(Type *t) { push(DtoTypeInfoOf(Loc(), t)); }
void RTTIBuilder::push_string(const char *str) { push(DtoConstString(str)); }
void RTTIBuilder::push_null_void_array() {
LLType *T = DtoType(Type::tvoid->arrayOf());
LLType *T = DtoType(arrayOf(Type::tvoid));
push(getNullValue(T));
}
@ -92,7 +92,7 @@ void RTTIBuilder::push_void_array(llvm::Constant *CI, Type *valtype,
void RTTIBuilder::push_array(llvm::Constant *CI, uint64_t dim, Type *valtype,
Dsymbol *mangle_sym) {
std::string tmpStr(valtype->arrayOf()->toChars());
std::string tmpStr(arrayOf(valtype)->toChars());
tmpStr.erase(remove(tmpStr.begin(), tmpStr.end(), '['), tmpStr.end());
tmpStr.erase(remove(tmpStr.begin(), tmpStr.end(), ']'), tmpStr.end());
tmpStr.append("arr");

View file

@ -492,11 +492,11 @@ static void buildRuntimeModule() {
Type *dcharTy = Type::tdchar;
Type *voidPtrTy = Type::tvoidptr;
Type *voidArrayTy = Type::tvoid->arrayOf();
Type *voidArrayTy = arrayOf(Type::tvoid);
Type *voidArrayPtrTy = pointerTo(voidArrayTy);
Type *stringTy = Type::tchar->arrayOf();
Type *wstringTy = Type::twchar->arrayOf();
Type *dstringTy = Type::tdchar->arrayOf();
Type *stringTy = arrayOf(Type::tchar);
Type *wstringTy = arrayOf(Type::twchar);
Type *dstringTy = arrayOf(Type::tdchar);
// LDC's AA type is rt.aaA.Impl*; use void* for the prototypes
Type *aaTy = voidPtrTy;
@ -823,7 +823,7 @@ static void buildRuntimeModule() {
// uint[] data, ubyte minPercent)
if (global.params.cov) {
createFwdDecl(LINK::c, voidTy, {"_d_cover_register2"},
{stringTy, sizeTy->arrayOf(), uintTy->arrayOf(), ubyteTy});
{stringTy, arrayOf(sizeTy), arrayOf(uintTy), ubyteTy});
}
if (target.objc.supported) {

View file

@ -247,7 +247,7 @@ static LLValue *getTypeinfoArrayArgumentForDVarArg(Expressions *argexps,
LLConstant *pinits[] = {
DtoConstSize_t(numVariadicArgs),
llvm::ConstantExpr::getBitCast(typeinfomem, getPtrToType(typeinfotype))};
LLType *tiarrty = DtoType(getTypeInfoType()->arrayOf());
LLType *tiarrty = DtoType(arrayOf(getTypeInfoType()));
tiinits = LLConstantStruct::get(isaStruct(tiarrty),
llvm::ArrayRef<LLConstant *>(pinits));
LLValue *typeinfoarrayparam = new llvm::GlobalVariable(

View file

@ -39,6 +39,8 @@
#include "ir/irtypefunction.h"
#include "ir/irtypestruct.h"
using namespace dmd;
bool DtoIsInMemoryOnly(Type *type) {
Type *typ = type->toBasetype();
TY t = typ->ty;
@ -516,7 +518,7 @@ LLConstant *DtoConstCString(const char *str) {
LLConstant *DtoConstString(const char *str) {
LLConstant *cString = DtoConstCString(str);
LLConstant *length = DtoConstSize_t(str ? strlen(str) : 0);
return DtoConstSlice(length, cString, Type::tchar->arrayOf());
return DtoConstSlice(length, cString, arrayOf(Type::tchar));
}
////////////////////////////////////////////////////////////////////////////////