mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-11 18:33:14 +01:00
Cleanup: Avoid signed/unsigned comparisons.
The ones ones left are for DMD-defined constants.
This commit is contained in:
@@ -682,7 +682,7 @@ Params parseArgs(int originalArgc, char** originalArgv, ls::Path ldcPath)
|
||||
else if (strcmp(p + 1, "run") == 0)
|
||||
{
|
||||
result.run = true;
|
||||
int runargCount = ((i >= originalArgc) ? argc : originalArgc) - i - 1;
|
||||
int runargCount = (((int)i >= originalArgc) ? argc : originalArgc) - i - 1;
|
||||
if (runargCount)
|
||||
{
|
||||
result.files.push_back(argv[i + 1]);
|
||||
|
||||
@@ -83,7 +83,7 @@ static int ExecuteToolAndWait(llvm::sys::Path tool, std::vector<std::string> arg
|
||||
if (verbose)
|
||||
{
|
||||
// Print it
|
||||
for (int i = 0; i < realargs.size()-1; i++)
|
||||
for (size_t i = 0; i < realargs.size()-1; i++)
|
||||
printf("%s ", realargs[i]);
|
||||
printf("\n");
|
||||
fflush(stdout);
|
||||
|
||||
@@ -1138,7 +1138,7 @@ int main(int argc, char** argv)
|
||||
llvm::Linker linker("ldc", moduleName, context);
|
||||
|
||||
std::string errormsg;
|
||||
for (int i = 0; i < llvmModules.size(); i++)
|
||||
for (size_t i = 0; i < llvmModules.size(); i++)
|
||||
{
|
||||
if(linker.LinkInModule(llvmModules[i], &errormsg))
|
||||
error("%s", errormsg.c_str());
|
||||
|
||||
@@ -319,7 +319,7 @@ assert(0 && "asm fixme Arg_LocalSize");
|
||||
// FIXME
|
||||
// if (! irs->func->naked) {
|
||||
assert(asmparser);
|
||||
for (int i = 0; i < code->regs.size(); i++) {
|
||||
for (size_t i = 0; i < code->regs.size(); i++) {
|
||||
if (code->regs[i]) {
|
||||
clobbers.push_back(asmparser->getRegName(i));
|
||||
}
|
||||
|
||||
@@ -307,7 +307,7 @@ DValue* DtoCastClass(DValue* val, Type* _to)
|
||||
// find interface impl
|
||||
|
||||
size_t i_index = typeclass->getInterfaceIndex(it);
|
||||
assert(i_index != ~0 && "requesting interface that is not implemented by this class");
|
||||
assert(i_index != ~0UL && "requesting interface that is not implemented by this class");
|
||||
|
||||
// offset pointer
|
||||
LLValue* v = val->getRVal();
|
||||
|
||||
@@ -182,9 +182,8 @@ void VarDeclaration::codegen(Ir* p)
|
||||
|
||||
// Set the alignment (it is important not to use type->alignsize because
|
||||
// VarDeclarations can have an align() attribute independent of the type
|
||||
// as well). FIXME: ~0 is really STRUCTALIGN_DEFAULT, change as soon as
|
||||
// 1.075 has been merged.
|
||||
if (alignment != ~0)
|
||||
// as well).
|
||||
if (alignment != STRUCTALIGN_DEFAULT)
|
||||
gvar->setAlignment(alignment);
|
||||
|
||||
if (Logger::enabled())
|
||||
|
||||
@@ -565,7 +565,7 @@ static void set_param_attrs(TypeFunction* f, llvm::Function* func, FuncDeclarati
|
||||
}
|
||||
|
||||
// build rest of attrs list
|
||||
for (int i = 0; i < n; i++)
|
||||
for (size_t i = 0; i < n; i++)
|
||||
{
|
||||
if (HAS_ATTRIBUTES(attrptr[i]))
|
||||
{
|
||||
@@ -789,7 +789,7 @@ void DtoDeclareFunction(FuncDeclaration* fdecl)
|
||||
++iarg;
|
||||
}
|
||||
|
||||
int k = 0;
|
||||
unsigned int k = 0;
|
||||
|
||||
for (; iarg != func->arg_end(); ++iarg)
|
||||
{
|
||||
@@ -940,7 +940,7 @@ void DtoDefineFunction(FuncDeclaration* fd)
|
||||
{
|
||||
size_t n = f->fty.args.size();
|
||||
assert(n == fd->parameters->dim);
|
||||
for (int i=0; i < n; ++i)
|
||||
for (size_t i=0; i < n; ++i)
|
||||
{
|
||||
Dsymbol* argsym = static_cast<Dsymbol*>(fd->parameters->data[i]);
|
||||
VarDeclaration* vd = argsym->isVarDeclaration();
|
||||
|
||||
@@ -1113,7 +1113,7 @@ void UnrolledLoopStatement::toIR(IRState* p)
|
||||
// do statements
|
||||
Statement** stmts = (Statement**)statements->data;
|
||||
|
||||
for (int i=0; i<nstmt; i++)
|
||||
for (size_t i=0; i<nstmt; i++)
|
||||
{
|
||||
Statement* s = stmts[i];
|
||||
|
||||
|
||||
@@ -146,7 +146,7 @@ LLFunctionType* DtoExtractFunctionType(LLType* type)
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static LLValue *fixArgument(DValue *argval, TypeFunction* tf, LLType *callableArgType, int argIndex)
|
||||
static LLValue *fixArgument(DValue *argval, TypeFunction* tf, LLType *callableArgType, size_t argIndex)
|
||||
{
|
||||
#if 0
|
||||
if (Logger::enabled()) {
|
||||
@@ -220,7 +220,7 @@ void DtoBuildDVarArgList(std::vector<LLValue*>& args,
|
||||
size_t n_arguments = arguments ? arguments->dim : 0;
|
||||
|
||||
// build struct with argument types (non variadic args)
|
||||
for (int i=begin; i<n_arguments; i++)
|
||||
for (size_t i=begin; i<n_arguments; i++)
|
||||
{
|
||||
Expression* argexp = static_cast<Expression*>(arguments->data[i]);
|
||||
assert(argexp->type->ty != Ttuple);
|
||||
@@ -257,7 +257,7 @@ void DtoBuildDVarArgList(std::vector<LLValue*>& args,
|
||||
LLValue* mem = DtoRawAlloca(vtype, 0, "_argptr_storage");
|
||||
|
||||
// store arguments in the struct
|
||||
for (int i=begin,k=0; i<n_arguments; i++,k++)
|
||||
for (size_t i=begin,k=0; i<n_arguments; i++,k++)
|
||||
{
|
||||
Expression* argexp = static_cast<Expression*>(arguments->data[i]);
|
||||
LLValue* argdst = DtoGEPi(mem,0,k);
|
||||
@@ -275,7 +275,7 @@ void DtoBuildDVarArgList(std::vector<LLValue*>& args,
|
||||
Logger::cout() << "_arguments storage: " << *typeinfomem << '\n';
|
||||
|
||||
std::vector<LLConstant*> vtypeinfos;
|
||||
for (int i=begin,k=0; i<n_arguments; i++,k++)
|
||||
for (size_t i=begin; i<n_arguments; i++)
|
||||
{
|
||||
Expression* argexp = static_cast<Expression*>(arguments->data[i]);
|
||||
vtypeinfos.push_back(DtoTypeInfoOf(argexp->type));
|
||||
@@ -491,7 +491,7 @@ DValue* DtoCallFunction(Loc& loc, Type* resulttype, DValue* fnval, Expressions*
|
||||
// variadic intrinsics need some custom casts
|
||||
if (va_intrinsic)
|
||||
{
|
||||
for (int i=0; i<n_arguments; i++)
|
||||
for (size_t i=0; i<n_arguments; i++)
|
||||
{
|
||||
Expression* exp = static_cast<Expression*>(arguments->data[i]);
|
||||
DValue* expelem = exp->toElem(gIR);
|
||||
@@ -540,7 +540,7 @@ DValue* DtoCallFunction(Loc& loc, Type* resulttype, DValue* fnval, Expressions*
|
||||
argvals.insert(argvals.begin(), argval);
|
||||
}
|
||||
} else {
|
||||
for (int i=0; i<n; ++i) {
|
||||
for (size_t i=0; i<n; ++i) {
|
||||
Parameter* fnarg = Parameter::getNth(tf->parameters, i);
|
||||
assert(fnarg);
|
||||
DValue* argval = DtoArgument(fnarg, static_cast<Expression*>(arguments->data[i]));
|
||||
@@ -550,7 +550,7 @@ DValue* DtoCallFunction(Loc& loc, Type* resulttype, DValue* fnval, Expressions*
|
||||
|
||||
// do formal params
|
||||
int beg = argiter-argbegin;
|
||||
for (int i=0; i<n; i++)
|
||||
for (size_t i=0; i<n; i++)
|
||||
{
|
||||
DValue* argval = argvals.at(i);
|
||||
|
||||
@@ -570,7 +570,7 @@ DValue* DtoCallFunction(Loc& loc, Type* resulttype, DValue* fnval, Expressions*
|
||||
}
|
||||
|
||||
// add attributes
|
||||
for (int i = 0; i < n; i++)
|
||||
for (size_t i = 0; i < n; i++)
|
||||
{
|
||||
if (HAS_ATTRIBUTES(attrptr[i]))
|
||||
{
|
||||
@@ -583,7 +583,7 @@ DValue* DtoCallFunction(Loc& loc, Type* resulttype, DValue* fnval, Expressions*
|
||||
// do C varargs
|
||||
if (n_arguments > n)
|
||||
{
|
||||
for (int i=n; i<n_arguments; i++)
|
||||
for (size_t i=n; i<n_arguments; i++)
|
||||
{
|
||||
Parameter* fnarg = Parameter::getNth(tf->parameters, i);
|
||||
DValue* argval = DtoArgument(fnarg, static_cast<Expression*>(arguments->data[i]));
|
||||
|
||||
@@ -3251,7 +3251,7 @@ DValue* VectorExp::toElem(IRState* p)
|
||||
ArrayLiteralExp *e = static_cast<ArrayLiteralExp*>(e1);
|
||||
assert(e->elements->dim == dim && "Array literal vector initializer "
|
||||
"length mismatch, should have been handled in frontend.");
|
||||
for (int i = 0; i < dim; ++i) {
|
||||
for (unsigned int i = 0; i < dim; ++i) {
|
||||
DValue *val = ((*e->elements)[i])->toElem(p);
|
||||
LLValue *llval = DtoCast(loc, val, type->elementType())->getRVal();
|
||||
DtoStore(llval, DtoGEPi(vector, 0, i));
|
||||
@@ -3260,7 +3260,7 @@ DValue* VectorExp::toElem(IRState* p)
|
||||
Logger::println("normal (splat) expression");
|
||||
DValue *val = e1->toElem(p);
|
||||
LLValue* llval = DtoCast(loc, val, type->elementType())->getRVal();
|
||||
for (int i = 0; i < dim; ++i) {
|
||||
for (unsigned int i = 0; i < dim; ++i) {
|
||||
DtoStore(llval, DtoGEPi(vector, 0, i));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,9 +57,9 @@ llvm::Value* IrFuncTy::getRet(Type* dty, DValue* val)
|
||||
return val->getRVal();
|
||||
}
|
||||
|
||||
llvm::Value* IrFuncTy::putParam(Type* dty, int idx, DValue* val)
|
||||
llvm::Value* IrFuncTy::putParam(Type* dty, size_t idx, DValue* val)
|
||||
{
|
||||
assert(idx >= 0 && idx < args.size() && "invalid putParam");
|
||||
assert(idx < args.size() && "invalid putParam");
|
||||
if (args[idx]->rewrite) {
|
||||
Logger::println("Rewrite: putParam");
|
||||
LOG_SCOPE
|
||||
@@ -68,9 +68,9 @@ llvm::Value* IrFuncTy::putParam(Type* dty, int idx, DValue* val)
|
||||
return val->getRVal();
|
||||
}
|
||||
|
||||
llvm::Value* IrFuncTy::getParam(Type* dty, int idx, DValue* val)
|
||||
llvm::Value* IrFuncTy::getParam(Type* dty, size_t idx, DValue* val)
|
||||
{
|
||||
assert(idx >= 0 && idx < args.size() && "invalid getParam");
|
||||
assert(idx < args.size() && "invalid getParam");
|
||||
if (args[idx]->rewrite) {
|
||||
Logger::println("Rewrite: getParam (get)");
|
||||
LOG_SCOPE
|
||||
@@ -79,9 +79,9 @@ llvm::Value* IrFuncTy::getParam(Type* dty, int idx, DValue* val)
|
||||
return val->getRVal();
|
||||
}
|
||||
|
||||
void IrFuncTy::getParam(Type* dty, int idx, DValue* val, llvm::Value* lval)
|
||||
void IrFuncTy::getParam(Type* dty, size_t idx, DValue* val, llvm::Value* lval)
|
||||
{
|
||||
assert(idx >= 0 && idx < args.size() && "invalid getParam");
|
||||
assert(idx < args.size() && "invalid getParam");
|
||||
|
||||
if (args[idx]->rewrite)
|
||||
{
|
||||
|
||||
@@ -157,9 +157,9 @@ struct IrFuncTy : IrBase
|
||||
llvm::Value* putRet(Type* dty, DValue* dval);
|
||||
llvm::Value* getRet(Type* dty, DValue* dval);
|
||||
|
||||
llvm::Value* putParam(Type* dty, int idx, DValue* dval);
|
||||
llvm::Value* getParam(Type* dty, int idx, DValue* dval);
|
||||
void getParam(Type* dty, int idx, DValue* dval, llvm::Value* lval);
|
||||
llvm::Value* putParam(Type* dty, size_t idx, DValue* dval);
|
||||
llvm::Value* getParam(Type* dty, size_t idx, DValue* dval);
|
||||
void getParam(Type* dty, size_t idx, DValue* dval, llvm::Value* lval);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -324,7 +324,7 @@ std::vector<llvm::Type*> IrTypeClass::buildVtblType(Type* first, Array* vtbl_arr
|
||||
{
|
||||
Logger::println("Running late semantic3 to infer return type.");
|
||||
TemplateInstance *spec = fd->isSpeculative();
|
||||
int olderrs = global.errors;
|
||||
unsigned int olderrs = global.errors;
|
||||
fd->semantic3(fd->scope);
|
||||
if (spec && global.errors != olderrs)
|
||||
spec->errors = global.errors - olderrs;
|
||||
@@ -360,7 +360,7 @@ size_t IrTypeClass::getInterfaceIndex(ClassDeclaration * inter)
|
||||
{
|
||||
ClassIndexMap::iterator it = interfaceMap.find(inter);
|
||||
if (it == interfaceMap.end())
|
||||
return ~0;
|
||||
return ~0UL;
|
||||
return it->second;
|
||||
}
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ void processRecord(raw_ostream& os, Record& rec, string arch)
|
||||
|
||||
ListInit* paramsList = rec.getValueAsListInit("ParamTypes");
|
||||
vector<string> params;
|
||||
for(int i = 0; i < paramsList->getSize(); i++)
|
||||
for(unsigned int i = 0; i < paramsList->getSize(); i++)
|
||||
{
|
||||
string t = dtype(paramsList->getElementAsRecord(i));
|
||||
if(t == "")
|
||||
@@ -128,7 +128,7 @@ void processRecord(raw_ostream& os, Record& rec, string arch)
|
||||
if(params.size())
|
||||
os << params[0];
|
||||
|
||||
for(int i = 1; i < params.size(); i++)
|
||||
for(size_t i = 1; i < params.size(); i++)
|
||||
os << ", " << params[i];
|
||||
|
||||
os << ")" + attributes(rec.getValueAsListInit("Properties")) + ";\n\n";
|
||||
|
||||
Reference in New Issue
Block a user