Fixes 2 kinds of warnings.

1) The last parameter of getGetElementPtr() has type bool. In some instances, a 2 is used as parameter. This is converted to true.
2) Several loops use int instead of unsigned. This causes warning about signed/unsigned mismatch.

Curiously, only Visual C++ complains about this. Nevertheless I think that the warnings should be fixed.
This commit is contained in:
kai 2011-11-23 19:01:04 +01:00
parent 7753acf176
commit a5b3dd29b5
13 changed files with 44 additions and 44 deletions

View file

@ -554,7 +554,7 @@ LLConstant* DtoConstArrayInitializer(ArrayInitializer* arrinit)
LLConstant* idxs[2] = { DtoConstUint(0), DtoConstUint(0) }; LLConstant* idxs[2] = { DtoConstUint(0), DtoConstUint(0) };
LLConstant* gep = llvm::ConstantExpr::getGetElementPtr(gvar,idxs,2); LLConstant* gep = llvm::ConstantExpr::getGetElementPtr(gvar, idxs, true);
gep = llvm::ConstantExpr::getBitCast(gvar, getPtrToType(llelemty)); gep = llvm::ConstantExpr::getBitCast(gvar, getPtrToType(llelemty));
return DtoConstSlice(DtoConstSize_t(arrlen), gep, arrty); return DtoConstSlice(DtoConstSize_t(arrlen), gep, arrty);

View file

@ -2088,7 +2088,7 @@ namespace AsmParserx8632
Logger::cout() << "baseReg: " << operand->baseReg << '\n'; Logger::cout() << "baseReg: " << operand->baseReg << '\n';
Logger::cout() << "segmentPrefix: " << operand->segmentPrefix << '\n'; Logger::cout() << "segmentPrefix: " << operand->segmentPrefix << '\n';
Logger::cout() << "constDisplacement: " << operand->constDisplacement << '\n'; Logger::cout() << "constDisplacement: " << operand->constDisplacement << '\n';
for (int i = 0; i < operand->symbolDisplacement.dim; i++) { for (unsigned i = 0; i < operand->symbolDisplacement.dim; i++) {
Expression* expr = (Expression*) operand->symbolDisplacement.data[i]; Expression* expr = (Expression*) operand->symbolDisplacement.data[i];
Logger::cout() << "symbolDisplacement[" << i << "] = " << expr->toChars() << '\n'; Logger::cout() << "symbolDisplacement[" << i << "] = " << expr->toChars() << '\n';
} }

View file

@ -2243,7 +2243,7 @@ namespace AsmParserx8664
Logger::cout() << "baseReg: " << operand->baseReg << '\n'; Logger::cout() << "baseReg: " << operand->baseReg << '\n';
Logger::cout() << "segmentPrefix: " << operand->segmentPrefix << '\n'; Logger::cout() << "segmentPrefix: " << operand->segmentPrefix << '\n';
Logger::cout() << "constDisplacement: " << operand->constDisplacement << '\n'; Logger::cout() << "constDisplacement: " << operand->constDisplacement << '\n';
for (int i = 0; i < operand->symbolDisplacement.dim; i++) { for (unsigned i = 0; i < operand->symbolDisplacement.dim; i++) {
Expression* expr = (Expression*) operand->symbolDisplacement.data[i]; Expression* expr = (Expression*) operand->symbolDisplacement.data[i];
Logger::cout() << "symbolDisplacement[" << i << "] = " << expr->toChars() << '\n'; Logger::cout() << "symbolDisplacement[" << i << "] = " << expr->toChars() << '\n';
} }

View file

@ -534,7 +534,7 @@ void AsmBlockStatement::toIR(IRState* p)
p->asmBlock = asmblock; p->asmBlock = asmblock;
// do asm statements // do asm statements
for (int i=0; i<statements->dim; i++) for (unsigned i=0; i<statements->dim; i++)
{ {
Statement* s = (Statement*)statements->data[i]; Statement* s = (Statement*)statements->data[i];
if (s) { if (s) {

View file

@ -221,7 +221,7 @@ void TemplateInstance::codegen(Ir* p)
#endif #endif
if (!errors && members) if (!errors && members)
{ {
for (int i = 0; i < members->dim; i++) for (unsigned i = 0; i < members->dim; i++)
{ {
Dsymbol *s = (Dsymbol *)members->data[i]; Dsymbol *s = (Dsymbol *)members->data[i];
s->codegen(p); s->codegen(p);
@ -235,7 +235,7 @@ void TemplateMixin::codegen(Ir* p)
{ {
if (!errors && members) if (!errors && members)
{ {
for (int i = 0; i < members->dim; i++) for (unsigned i = 0; i < members->dim; i++)
{ {
Dsymbol *s = (Dsymbol *)members->data[i]; Dsymbol *s = (Dsymbol *)members->data[i];
if (s->isVarDeclaration()) if (s->isVarDeclaration())

View file

@ -1134,7 +1134,7 @@ DValue* DtoDeclarationExp(Dsymbol* declaration)
// choose the right set in case this is a conditional declaration // choose the right set in case this is a conditional declaration
Array *d = a->include(NULL, NULL); Array *d = a->include(NULL, NULL);
if (d) if (d)
for (int i=0; i < d->dim; ++i) for (unsigned i=0; i < d->dim; ++i)
{ {
DtoDeclarationExp((Dsymbol*)d->data[i]); DtoDeclarationExp((Dsymbol*)d->data[i]);
} }
@ -1143,7 +1143,7 @@ DValue* DtoDeclarationExp(Dsymbol* declaration)
else if (TemplateMixin* m = declaration->isTemplateMixin()) else if (TemplateMixin* m = declaration->isTemplateMixin())
{ {
Logger::println("TemplateMixin"); Logger::println("TemplateMixin");
for (int i=0; i < m->members->dim; ++i) for (unsigned i=0; i < m->members->dim; ++i)
{ {
Dsymbol* mdsym = (Dsymbol*)m->members->data[i]; Dsymbol* mdsym = (Dsymbol*)m->members->data[i];
DtoDeclarationExp(mdsym); DtoDeclarationExp(mdsym);
@ -1159,7 +1159,7 @@ DValue* DtoDeclarationExp(Dsymbol* declaration)
} }
assert(tupled->objects); assert(tupled->objects);
for (int i=0; i < tupled->objects->dim; ++i) for (unsigned i=0; i < tupled->objects->dim; ++i)
{ {
DsymbolExp* exp = (DsymbolExp*)tupled->objects->data[i]; DsymbolExp* exp = (DsymbolExp*)tupled->objects->data[i];
DtoDeclarationExp(exp->s); DtoDeclarationExp(exp->s);
@ -1637,7 +1637,7 @@ bool hasUnalignedFields(Type* t)
// go through all the fields and try to find something unaligned // go through all the fields and try to find something unaligned
ts->unaligned = 2; ts->unaligned = 2;
for (int i = 0; i < sym->fields.dim; i++) for (unsigned i = 0; i < sym->fields.dim; i++)
{ {
VarDeclaration* f = (VarDeclaration*)sym->fields.data[i]; VarDeclaration* f = (VarDeclaration*)sym->fields.data[i];
unsigned a = f->type->alignsize() - 1; unsigned a = f->type->alignsize() - 1;

View file

@ -308,7 +308,7 @@ int main(int argc, char** argv)
{ {
if (libs) if (libs)
{ {
for (int i = 0; i < libs->dim; i++) for (unsigned i = 0; i < libs->dim; i++)
{ {
char* lib = (char *)libs->data[i]; char* lib = (char *)libs->data[i];
char *arg = (char *)mem.malloc(strlen(lib) + 3); char *arg = (char *)mem.malloc(strlen(lib) + 3);
@ -649,7 +649,7 @@ int main(int argc, char** argv)
// Build import search path // Build import search path
if (global.params.imppath) if (global.params.imppath)
{ {
for (int i = 0; i < global.params.imppath->dim; i++) for (unsigned i = 0; i < global.params.imppath->dim; i++)
{ {
char *path = (char *)global.params.imppath->data[i]; char *path = (char *)global.params.imppath->data[i];
Strings *a = FileName::splitPath(path); Strings *a = FileName::splitPath(path);
@ -666,7 +666,7 @@ int main(int argc, char** argv)
// Build string import search path // Build string import search path
if (global.params.fileImppath) if (global.params.fileImppath)
{ {
for (int i = 0; i < global.params.fileImppath->dim; i++) for (unsigned i = 0; i < global.params.fileImppath->dim; i++)
{ {
char *path = (char *)global.params.fileImppath->data[i]; char *path = (char *)global.params.fileImppath->data[i];
Strings *a = FileName::splitPath(path); Strings *a = FileName::splitPath(path);
@ -683,7 +683,7 @@ int main(int argc, char** argv)
// Create Modules // Create Modules
Modules modules; Modules modules;
modules.reserve(files.dim); modules.reserve(files.dim);
for (int i = 0; i < files.dim; i++) for (unsigned i = 0; i < files.dim; i++)
{ Identifier *id; { Identifier *id;
char *ext; char *ext;
char *name; char *name;
@ -790,7 +790,7 @@ int main(int argc, char** argv)
} }
// Read files, parse them // Read files, parse them
for (int i = 0; i < modules.dim; i++) for (unsigned i = 0; i < modules.dim; i++)
{ {
m = (Module *)modules.data[i]; m = (Module *)modules.data[i];
if (global.params.verbose) if (global.params.verbose)
@ -825,7 +825,7 @@ int main(int argc, char** argv)
* line switches and what else is imported, they are generated * line switches and what else is imported, they are generated
* before any semantic analysis. * before any semantic analysis.
*/ */
for (int i = 0; i < modules.dim; i++) for (unsigned i = 0; i < modules.dim; i++)
{ {
m = (Module *)modules.data[i]; m = (Module *)modules.data[i];
if (global.params.verbose) if (global.params.verbose)
@ -838,7 +838,7 @@ int main(int argc, char** argv)
#endif #endif
// load all unconditional imports for better symbol resolving // load all unconditional imports for better symbol resolving
for (int i = 0; i < modules.dim; i++) for (unsigned i = 0; i < modules.dim; i++)
{ {
m = (Module *)modules.data[i]; m = (Module *)modules.data[i];
if (global.params.verbose) if (global.params.verbose)
@ -849,7 +849,7 @@ int main(int argc, char** argv)
fatal(); fatal();
// Do semantic analysis // Do semantic analysis
for (int i = 0; i < modules.dim; i++) for (unsigned i = 0; i < modules.dim; i++)
{ {
m = (Module *)modules.data[i]; m = (Module *)modules.data[i];
if (global.params.verbose) if (global.params.verbose)
@ -863,7 +863,7 @@ int main(int argc, char** argv)
Module::runDeferredSemantic(); Module::runDeferredSemantic();
// Do pass 2 semantic analysis // Do pass 2 semantic analysis
for (int i = 0; i < modules.dim; i++) for (unsigned i = 0; i < modules.dim; i++)
{ {
m = (Module *)modules.data[i]; m = (Module *)modules.data[i];
if (global.params.verbose) if (global.params.verbose)
@ -874,7 +874,7 @@ int main(int argc, char** argv)
fatal(); fatal();
// Do pass 3 semantic analysis // Do pass 3 semantic analysis
for (int i = 0; i < modules.dim; i++) for (unsigned i = 0; i < modules.dim; i++)
{ {
m = (Module *)modules.data[i]; m = (Module *)modules.data[i];
if (global.params.verbose) if (global.params.verbose)
@ -904,7 +904,7 @@ int main(int argc, char** argv)
{ {
// Do pass 3 semantic analysis on all imported modules, // Do pass 3 semantic analysis on all imported modules,
// since otherwise functions in them cannot be inlined // since otherwise functions in them cannot be inlined
for (int i = 0; i < Module::amodules.dim; i++) for (unsigned i = 0; i < Module::amodules.dim; i++)
{ {
m = (Module *)Module::amodules.data[i]; m = (Module *)Module::amodules.data[i];
if (global.params.verbose) if (global.params.verbose)
@ -944,7 +944,7 @@ int main(int argc, char** argv)
llvm::LLVMContext& context = llvm::getGlobalContext(); llvm::LLVMContext& context = llvm::getGlobalContext();
// Generate output files // Generate output files
for (int i = 0; i < modules.dim; i++) for (unsigned i = 0; i < modules.dim; i++)
{ {
m = (Module *)modules.data[i]; m = (Module *)modules.data[i];
if (global.params.verbose) if (global.params.verbose)
@ -1019,7 +1019,7 @@ int main(int argc, char** argv)
/* Delete .obj files and .exe file /* Delete .obj files and .exe file
*/ */
for (int i = 0; i < modules.dim; i++) for (unsigned i = 0; i < modules.dim; i++)
{ {
m = (Module *)modules.data[i]; m = (Module *)modules.data[i];
m->deleteObjFile(); m->deleteObjFile();

View file

@ -36,7 +36,7 @@ void CompoundStatement::toIR(IRState* p)
Logger::println("CompoundStatement::toIR(): %s", loc.toChars()); Logger::println("CompoundStatement::toIR(): %s", loc.toChars());
LOG_SCOPE; LOG_SCOPE;
for (int i=0; i<statements->dim; i++) for (unsigned i=0; i<statements->dim; i++)
{ {
Statement* s = (Statement*)statements->data[i]; Statement* s = (Statement*)statements->data[i];
if (s) { if (s) {
@ -741,7 +741,7 @@ void TryCatchStatement::toIR(IRState* p)
gIR->scope() = IRScope(landingpadbb, endbb); gIR->scope() = IRScope(landingpadbb, endbb);
IRLandingPad& pad = gIR->func()->gen->landingPadInfo; IRLandingPad& pad = gIR->func()->gen->landingPadInfo;
for (int i = 0; i < catches->dim; i++) for (unsigned i = 0; i < catches->dim; i++)
{ {
Catch *c = (Catch *)catches->data[i]; Catch *c = (Catch *)catches->data[i];
pad.addCatch(c, endbb); pad.addCatch(c, endbb);
@ -870,7 +870,7 @@ void SwitchStatement::toIR(IRState* p)
llvm::BasicBlock* oldend = gIR->scopeend(); llvm::BasicBlock* oldend = gIR->scopeend();
// clear data from previous passes... :/ // clear data from previous passes... :/
for (int i=0; i<cases->dim; ++i) for (unsigned i=0; i<cases->dim; ++i)
{ {
CaseStatement* cs = (CaseStatement*)cases->data[i]; CaseStatement* cs = (CaseStatement*)cases->data[i];
cs->bodyBB = NULL; cs->bodyBB = NULL;
@ -881,7 +881,7 @@ void SwitchStatement::toIR(IRState* p)
// 'switch' instruction (that can happen because D2 allows to // 'switch' instruction (that can happen because D2 allows to
// initialize a global variable in a static constructor). // initialize a global variable in a static constructor).
bool useSwitchInst = true; bool useSwitchInst = true;
for (int i=0; i<cases->dim; ++i) for (unsigned i=0; i<cases->dim; ++i)
{ {
CaseStatement* cs = (CaseStatement*)cases->data[i]; CaseStatement* cs = (CaseStatement*)cases->data[i];
VarDeclaration* vd = 0; VarDeclaration* vd = 0;
@ -928,7 +928,7 @@ void SwitchStatement::toIR(IRState* p)
Logger::println("is string switch"); Logger::println("is string switch");
// build array of the stringexpS // build array of the stringexpS
caseArray.reserve(cases->dim); caseArray.reserve(cases->dim);
for (int i=0; i<cases->dim; ++i) for (unsigned i=0; i<cases->dim; ++i)
{ {
CaseStatement* cs = (CaseStatement*)cases->data[i]; CaseStatement* cs = (CaseStatement*)cases->data[i];
@ -980,7 +980,7 @@ void SwitchStatement::toIR(IRState* p)
// create switch and add the cases // create switch and add the cases
llvm::SwitchInst* si = llvm::SwitchInst::Create(condVal, defbb ? defbb : endbb, cases->dim, p->scopebb()); llvm::SwitchInst* si = llvm::SwitchInst::Create(condVal, defbb ? defbb : endbb, cases->dim, p->scopebb());
for (int i=0; i<cases->dim; ++i) for (unsigned i=0; i<cases->dim; ++i)
{ {
CaseStatement* cs = (CaseStatement*)cases->data[i]; CaseStatement* cs = (CaseStatement*)cases->data[i];
si->addCase(isaConstantInt(cs->llvmIdx), cs->bodyBB); si->addCase(isaConstantInt(cs->llvmIdx), cs->bodyBB);
@ -995,7 +995,7 @@ void SwitchStatement::toIR(IRState* p)
llvm::BranchInst::Create(nextbb, p->scopebb()); llvm::BranchInst::Create(nextbb, p->scopebb());
p->scope() = IRScope(nextbb, endbb); p->scope() = IRScope(nextbb, endbb);
for (int i=0; i<cases->dim; ++i) for (unsigned i=0; i<cases->dim; ++i)
{ {
CaseStatement* cs = (CaseStatement*)cases->data[i]; CaseStatement* cs = (CaseStatement*)cases->data[i];

View file

@ -478,7 +478,7 @@ DValue* StringExp::toElem(IRState* p)
llvm::ConstantInt* zero = LLConstantInt::get(LLType::getInt32Ty(gIR->context()), 0, false); llvm::ConstantInt* zero = LLConstantInt::get(LLType::getInt32Ty(gIR->context()), 0, false);
LLConstant* idxs[2] = { zero, zero }; LLConstant* idxs[2] = { zero, zero };
LLConstant* arrptr = llvm::ConstantExpr::getGetElementPtr(gvar,idxs,2); LLConstant* arrptr = llvm::ConstantExpr::getGetElementPtr(gvar, idxs, true);
if (dtype->ty == Tarray) { if (dtype->ty == Tarray) {
LLConstant* clen = LLConstantInt::get(DtoSize_t(),len,false); LLConstant* clen = LLConstantInt::get(DtoSize_t(),len,false);
@ -554,7 +554,7 @@ LLConstant* StringExp::toConstElem(IRState* p)
llvm::ConstantInt* zero = LLConstantInt::get(LLType::getInt32Ty(gIR->context()), 0, false); llvm::ConstantInt* zero = LLConstantInt::get(LLType::getInt32Ty(gIR->context()), 0, false);
LLConstant* idxs[2] = { zero, zero }; LLConstant* idxs[2] = { zero, zero };
LLConstant* arrptr = llvm::ConstantExpr::getGetElementPtr(gvar,idxs,2); LLConstant* arrptr = llvm::ConstantExpr::getGetElementPtr(gvar, idxs, true);
if (t->ty == Tpointer) { if (t->ty == Tpointer) {
return arrptr; return arrptr;
@ -1074,7 +1074,7 @@ LLConstant* CastExp::toConstElem(IRState* p)
Type *type = vd->type->toBasetype(); Type *type = vd->type->toBasetype();
if (type->ty == Tarray || type->ty == Tdelegate) { if (type->ty == Tarray || type->ty == Tdelegate) {
LLConstant* idxs[2] = { DtoConstSize_t(0), DtoConstSize_t(1) }; LLConstant* idxs[2] = { DtoConstSize_t(0), DtoConstSize_t(1) };
value = llvm::ConstantExpr::getGetElementPtr(value, idxs, 2); value = llvm::ConstantExpr::getGetElementPtr(value, idxs, true);
} }
return DtoBitCast(value, DtoType(tb)); return DtoBitCast(value, DtoType(tb));
} }
@ -1206,7 +1206,7 @@ LLConstant* AddrExp::toConstElem(IRState* p)
LLConstant* idxs[2] = { DtoConstSize_t(0), index }; LLConstant* idxs[2] = { DtoConstSize_t(0), index };
LLConstant *val = isaConstant(vd->ir.irGlobal->value); LLConstant *val = isaConstant(vd->ir.irGlobal->value);
val = DtoBitCast(val, DtoType(vd->type->pointerTo())); val = DtoBitCast(val, DtoType(vd->type->pointerTo()));
LLConstant* gep = llvm::ConstantExpr::getGetElementPtr(val, idxs, 2); LLConstant* gep = llvm::ConstantExpr::getGetElementPtr(val, idxs, true);
// bitcast to requested type // bitcast to requested type
assert(type->toBasetype()->ty == Tpointer); assert(type->toBasetype()->ty == Tpointer);
@ -2751,7 +2751,7 @@ LLConstant* ArrayLiteralExp::toConstElem(IRState* p)
// build a constant dynamic array reference with the .ptr field pointing into globalstore // build a constant dynamic array reference with the .ptr field pointing into globalstore
LLConstant* idxs[2] = { DtoConstUint(0), DtoConstUint(0) }; LLConstant* idxs[2] = { DtoConstUint(0), DtoConstUint(0) };
LLConstant* globalstorePtr = llvm::ConstantExpr::getGetElementPtr(globalstore, idxs, 2); LLConstant* globalstorePtr = llvm::ConstantExpr::getGetElementPtr(globalstore, idxs, true);
return DtoConstSlice(DtoConstSize_t(elements->dim), globalstorePtr); return DtoConstSlice(DtoConstSize_t(elements->dim), globalstorePtr);
} }
@ -2975,14 +2975,14 @@ DValue* AssocArrayLiteralExp::toElem(IRState* p)
LLArrayType* arrtype = LLArrayType::get(DtoType(indexType), keys->dim); LLArrayType* arrtype = LLArrayType::get(DtoType(indexType), keys->dim);
LLConstant* initval = LLConstantArray::get(arrtype, keysInits); LLConstant* initval = LLConstantArray::get(arrtype, keysInits);
LLConstant* globalstore = new LLGlobalVariable(*gIR->module, arrtype, false, LLGlobalValue::InternalLinkage, initval, ".aaKeysStorage"); LLConstant* globalstore = new LLGlobalVariable(*gIR->module, arrtype, false, LLGlobalValue::InternalLinkage, initval, ".aaKeysStorage");
LLConstant* slice = llvm::ConstantExpr::getGetElementPtr(globalstore, idxs, 2); LLConstant* slice = llvm::ConstantExpr::getGetElementPtr(globalstore, idxs, true);
slice = DtoConstSlice(DtoConstSize_t(keys->dim), slice); slice = DtoConstSlice(DtoConstSize_t(keys->dim), slice);
LLValue* keysArray = DtoAggrPaint(slice, funcTy->getParamType(1)); LLValue* keysArray = DtoAggrPaint(slice, funcTy->getParamType(1));
arrtype = LLArrayType::get(DtoType(vtype), values->dim); arrtype = LLArrayType::get(DtoType(vtype), values->dim);
initval = LLConstantArray::get(arrtype, valuesInits); initval = LLConstantArray::get(arrtype, valuesInits);
globalstore = new LLGlobalVariable(*gIR->module, arrtype, false, LLGlobalValue::InternalLinkage, initval, ".aaValuesStorage"); globalstore = new LLGlobalVariable(*gIR->module, arrtype, false, LLGlobalValue::InternalLinkage, initval, ".aaValuesStorage");
slice = llvm::ConstantExpr::getGetElementPtr(globalstore, idxs, 2); slice = llvm::ConstantExpr::getGetElementPtr(globalstore, idxs, true);
slice = DtoConstSlice(DtoConstSize_t(keys->dim), slice); slice = DtoConstSlice(DtoConstSize_t(keys->dim), slice);
LLValue* valuesArray = DtoAggrPaint(slice, funcTy->getParamType(2)); LLValue* valuesArray = DtoAggrPaint(slice, funcTy->getParamType(2));

View file

@ -447,7 +447,7 @@ LLValue* DtoGEPi(LLValue* ptr, unsigned i0, unsigned i1, const char* var, llvm::
LLConstant* DtoGEPi(LLConstant* ptr, unsigned i0, unsigned i1) LLConstant* DtoGEPi(LLConstant* ptr, unsigned i0, unsigned i1)
{ {
LLValue* v[2] = { DtoConstUint(i0), DtoConstUint(i1) }; LLValue* v[2] = { DtoConstUint(i0), DtoConstUint(i1) };
return llvm::ConstantExpr::getGetElementPtr(ptr, v, 2); return llvm::ConstantExpr::getGetElementPtr(ptr, v, true);
} }
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
@ -596,7 +596,7 @@ LLConstant* DtoConstString(const char* str)
LLConstant* idxs[2] = { DtoConstUint(0), DtoConstUint(0) }; LLConstant* idxs[2] = { DtoConstUint(0), DtoConstUint(0) };
return DtoConstSlice( return DtoConstSlice(
DtoConstSize_t(s.size()), DtoConstSize_t(s.size()),
llvm::ConstantExpr::getGetElementPtr(gvar,idxs,2), llvm::ConstantExpr::getGetElementPtr(gvar, idxs, true),
Type::tchar->arrayOf() Type::tchar->arrayOf()
); );
} }
@ -608,7 +608,7 @@ LLConstant* DtoConstStringPtr(const char* str, const char* section)
*gIR->module, init->getType(), true,llvm::GlobalValue::InternalLinkage, init, ".str"); *gIR->module, init->getType(), true,llvm::GlobalValue::InternalLinkage, init, ".str");
if (section) gvar->setSection(section); if (section) gvar->setSection(section);
LLConstant* idxs[2] = { DtoConstUint(0), DtoConstUint(0) }; LLConstant* idxs[2] = { DtoConstUint(0), DtoConstUint(0) };
return llvm::ConstantExpr::getGetElementPtr(gvar,idxs,2); return llvm::ConstantExpr::getGetElementPtr(gvar, idxs, true);
} }
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////

View file

@ -134,7 +134,7 @@ llvm::Module* Module::genLLVMModule(llvm::LLVMContext& context, Ir* sir)
LLVM_D_InitRuntime(); LLVM_D_InitRuntime();
// process module members // process module members
for (int k=0; k < members->dim; k++) { for (unsigned k=0; k < members->dim; k++) {
Dsymbol* dsym = (Dsymbol*)(members->data[k]); Dsymbol* dsym = (Dsymbol*)(members->data[k]);
assert(dsym); assert(dsym);
dsym->codegen(sir); dsym->codegen(sir);

View file

@ -711,7 +711,7 @@ void TypeInfoStructDeclaration::llvmDefine()
{ {
TypeTuple *tup = tc->toArgTypes(); TypeTuple *tup = tc->toArgTypes();
assert(tup->arguments->dim <= 2); assert(tup->arguments->dim <= 2);
for (int i = 0; i < 2; i++) for (unsigned i = 0; i < 2; i++)
{ {
if (i < tup->arguments->dim) if (i < tup->arguments->dim)
{ {

View file

@ -377,7 +377,7 @@ llvm::GlobalVariable * IrStruct::getInterfaceVtbl(BaseClass * b, bool new_instan
}; };
llvm::Constant* c = llvm::ConstantExpr::getGetElementPtr( llvm::Constant* c = llvm::ConstantExpr::getGetElementPtr(
getInterfaceArraySymbol(), idxs, 2); getInterfaceArraySymbol(), idxs, true);
constants.push_back(c); constants.push_back(c);
@ -533,7 +533,7 @@ LLConstant * IrStruct::getClassInfoInterfaces()
}; };
LLConstant* ptr = llvm::ConstantExpr::getGetElementPtr( LLConstant* ptr = llvm::ConstantExpr::getGetElementPtr(
classInterfacesArray, idxs, 2); classInterfacesArray, idxs, true);
// return as a slice // return as a slice
return DtoConstSlice( DtoConstSize_t(cd->vtblInterfaces->dim), ptr ); return DtoConstSlice( DtoConstSize_t(cd->vtblInterfaces->dim), ptr );