diff --git a/dmd/mtype.h b/dmd/mtype.h index 77b97ebd2f..b4d0a93e34 100644 --- a/dmd/mtype.h +++ b/dmd/mtype.h @@ -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(); diff --git a/gen/arrays.cpp b/gen/arrays.cpp index 5324f8a171..0ffa38879a 100644 --- a/gen/arrays.cpp +++ b/gen/arrays.cpp @@ -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"); diff --git a/gen/functions.cpp b/gen/functions.cpp index 4c63bf2e03..dfe4d71462 100644 --- a/gen/functions.cpp +++ b/gen/functions.cpp @@ -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; } diff --git a/gen/rttibuilder.cpp b/gen/rttibuilder.cpp index b2ec37be73..0d998b4de6 100644 --- a/gen/rttibuilder.cpp +++ b/gen/rttibuilder.cpp @@ -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"); diff --git a/gen/runtime.cpp b/gen/runtime.cpp index 459257da17..3f13351fd4 100644 --- a/gen/runtime.cpp +++ b/gen/runtime.cpp @@ -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) { diff --git a/gen/tocall.cpp b/gen/tocall.cpp index 4e348ba812..e8f0cd7939 100644 --- a/gen/tocall.cpp +++ b/gen/tocall.cpp @@ -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(pinits)); LLValue *typeinfoarrayparam = new llvm::GlobalVariable( diff --git a/gen/tollvm.cpp b/gen/tollvm.cpp index 628ef57107..7b08e3aa88 100644 --- a/gen/tollvm.cpp +++ b/gen/tollvm.cpp @@ -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)); } ////////////////////////////////////////////////////////////////////////////////