diff --git a/gen/abi-x86-64.cpp b/gen/abi-x86-64.cpp index 298ed018..d0c6a6b9 100644 --- a/gen/abi-x86-64.cpp +++ b/gen/abi-x86-64.cpp @@ -635,9 +635,7 @@ void X86_64TargetABI::rewriteFunctionType(TypeFunction* tf) { // Arguments that are in memory are of no interest to us. if (arg.byref) continue; - - Type* ty = arg.type->toBasetype(); - + fixup(arg); if (Logger::enabled()) Logger::cout() << "New arg type: " << *arg.ltype << '\n'; diff --git a/gen/arrays.cpp b/gen/arrays.cpp index 2f994e77..4af85bec 100644 --- a/gen/arrays.cpp +++ b/gen/arrays.cpp @@ -1306,9 +1306,9 @@ DValue* DtoCastArray(Loc& loc, DValue* u, Type* to) Logger::cout() << "uvalTy = " << *uval->getType() << '\n'; assert(isaPointer(uval->getType())); - const LLArrayType* arrty = isaArray(uval->getType()->getContainedType(0)); - - /*if(arrty->getNumElements()*fromtype->nextOf()->size() != tosize*totype->nextOf()->size()) + + /*const LLArrayType* arrty = isaArray(uval->getType()->getContainedType(0)); + if(arrty->getNumElements()*fromtype->nextOf()->size() != tosize*totype->nextOf()->size()) { error(loc, "invalid cast from '%s' to '%s', the sizes are not the same", fromtype->toChars(), totype->toChars()); fatal(); diff --git a/gen/cl_helpers.cpp b/gen/cl_helpers.cpp index 1e75fd0c..71e43dd7 100644 --- a/gen/cl_helpers.cpp +++ b/gen/cl_helpers.cpp @@ -10,13 +10,6 @@ namespace opts { -// Helper function -static char toLower(char c) { - if (isupper(c)) - return tolower(c); - return c; -} - bool FlagParser::parse(cl::Option &O, llvm::StringRef ArgName, llvm::StringRef Arg, bool &Val) { // Make a std::string out of it to make comparisons easier // (and avoid repeated conversion) @@ -55,7 +48,7 @@ MultiSetter::MultiSetter(bool invert, bool* p, ...) { locations.push_back(p); va_list va; va_start(va, p); - while (p = va_arg(va, bool*)) { + while ((p = va_arg(va, bool*))) { locations.push_back(p); } } diff --git a/gen/classes.cpp b/gen/classes.cpp index 64ab24df..96c4a990 100644 --- a/gen/classes.cpp +++ b/gen/classes.cpp @@ -293,7 +293,6 @@ DValue* DtoCastClass(DValue* val, Type* _to) // get the from class ClassDeclaration* cd = fc->sym->isClassDeclaration(); DtoResolveClass(cd); // add this - IrStruct* irstruct = cd->ir.irStruct; IrTypeClass* typeclass = fc->irtype->isClass(); // find interface impl @@ -332,7 +331,6 @@ DValue* DtoCastClass(DValue* val, Type* _to) // x -> class else { Logger::println("to class"); - int poffset; // interface -> class if (fc->sym->isInterfaceDeclaration()) { Logger::println("interface cast"); diff --git a/gen/complex.cpp b/gen/complex.cpp index ea12efd4..64b6867e 100644 --- a/gen/complex.cpp +++ b/gen/complex.cpp @@ -22,7 +22,6 @@ const llvm::StructType* DtoComplexType(Type* type) const LLType* DtoComplexBaseType(Type* t) { TY ty = t->toBasetype()->ty; - const LLType* base; if (ty == Tcomplex32) { return LLType::getFloatTy(gIR->context()); } @@ -46,11 +45,7 @@ LLConstant* DtoConstComplex(Type* _ty, long double re, long double im) { TY ty = _ty->toBasetype()->ty; - llvm::ConstantFP* fre; - llvm::ConstantFP* fim; - Type* base = 0; - if (ty == Tcomplex32) { base = Type::tfloat32; } @@ -132,8 +127,6 @@ void DtoComplexSet(LLValue* c, LLValue* re, LLValue* im) void DtoGetComplexParts(Loc& loc, Type* to, DValue* val, LLValue*& re, LLValue*& im) { - const LLType* base = DtoComplexBaseType(to); - Type* baserety; Type* baseimty; TY ty = to->toBasetype()->ty; @@ -403,7 +396,7 @@ LLValue* DtoComplexEquals(Loc& loc, TOK op, DValue* lhs, DValue* rhs) { Type* type = lhs->getType(); - llvm::Value *lhs_re, *lhs_im, *rhs_re, *rhs_im, *res_re, *res_im; + llvm::Value *lhs_re, *lhs_im, *rhs_re, *rhs_im; // lhs values DtoGetComplexParts(loc, type, lhs, lhs_re, lhs_im); diff --git a/gen/functions.cpp b/gen/functions.cpp index c09806ec..5062dc53 100644 --- a/gen/functions.cpp +++ b/gen/functions.cpp @@ -279,8 +279,7 @@ const llvm::FunctionType* DtoFunctionType(FuncDeclaration* fdecl) static llvm::Function* DtoDeclareVaFunction(FuncDeclaration* fdecl) { - TypeFunction* f = (TypeFunction*)fdecl->type->toBasetype(); - const llvm::FunctionType* fty = DtoVaFunctionType(fdecl); + DtoVaFunctionType(fdecl); llvm::Function* func = 0; if (fdecl->llvmInternal == LLVMva_start) @@ -370,8 +369,6 @@ void DtoResolveFunction(FuncDeclaration* fdecl) static void set_param_attrs(TypeFunction* f, llvm::Function* func, FuncDeclaration* fdecl) { - int funcNumArgs = func->getArgumentList().size(); - LLSmallVector attrs; llvm::AttributeWithIndex PAWI; @@ -648,7 +645,6 @@ void DtoDefineFunction(FuncDeclaration* fd) // assert(f->irtype); llvm::Function* func = fd->ir.irFunc->func; - const llvm::FunctionType* functype = func->getFunctionType(); // sanity check assert(mustDefineSymbol(fd)); diff --git a/gen/irstate.h b/gen/irstate.h index fb1460af..5461cd6d 100644 --- a/gen/irstate.h +++ b/gen/irstate.h @@ -91,8 +91,8 @@ struct IRAsmBlock LLValue* (*retfixup)(IRBuilderHelper b, LLValue* orig); // Modifies retval IRAsmBlock(AsmBlockStatement* b) - : asmBlock(b), retty(NULL), retn(0), retemu(false), retfixup(NULL), - outputcount(0) + : outputcount(0), asmBlock(b), retty(NULL), retn(0), retemu(false), + retfixup(NULL) {} }; diff --git a/gen/linker.cpp b/gen/linker.cpp index d2173c1f..b10a2b28 100644 --- a/gen/linker.cpp +++ b/gen/linker.cpp @@ -117,7 +117,6 @@ int linkExecutable(const char* argv0) args.push_back("-disable-opt"); else { - const char* s = 0; switch(optLevel()) { case 0: diff --git a/gen/llvmhelpers.cpp b/gen/llvmhelpers.cpp index 284d2894..aa03a2eb 100644 --- a/gen/llvmhelpers.cpp +++ b/gen/llvmhelpers.cpp @@ -906,8 +906,6 @@ void DtoConstInitGlobal(VarDeclaration* vd) Logger::println("DtoConstInitGlobal(%s) @ %s", vd->toChars(), vd->loc.toChars()); LOG_SCOPE; - Dsymbol* par = vd->toParent(); - // build the initializer LLConstant* initVal = DtoConstInitializer(vd->loc, vd->type, vd->init); @@ -922,8 +920,6 @@ void DtoConstInitGlobal(VarDeclaration* vd) glob->constInit = initVal; // assign the initializer - llvm::GlobalVariable* globalvar = llvm::cast(glob->value); - if (!(vd->storage_class & STCextern) && mustDefineSymbol(vd)) { if (Logger::enabled()) @@ -1040,7 +1036,7 @@ DValue* DtoDeclarationExp(Dsymbol* declaration) if (Logger::enabled()) Logger::cout() << "llvm value for decl: " << *vd->ir.irLocal->value << '\n'; if (!vd->isRef()) - DValue* ie = DtoInitializer(vd->ir.irLocal->value, vd->init); + DtoInitializer(vd->ir.irLocal->value, vd->init); // TODO: Remove altogether? } return new DVarValue(vd->type, vd, vd->ir.getIrValue()); @@ -1058,13 +1054,13 @@ DValue* DtoDeclarationExp(Dsymbol* declaration) f->codegen(Type::sir); } // alias declaration - else if (AliasDeclaration* a = declaration->isAliasDeclaration()) + else if (declaration->isAliasDeclaration()) { Logger::println("AliasDeclaration - no work"); // do nothing } // enum - else if (EnumDeclaration* e = declaration->isEnumDeclaration()) + else if (declaration->isEnumDeclaration()) { Logger::println("EnumDeclaration - no work"); // do nothing @@ -1144,7 +1140,6 @@ LLValue* DtoRawVarDeclaration(VarDeclaration* var, LLValue* addr) assert(!var->aliassym); // alloca if necessary - LLValue* allocaval = NULL; if (!addr && (!var->ir.irLocal || !var->ir.irLocal->value)) { addr = DtoAlloca(var->type, var->toChars()); @@ -1459,7 +1454,6 @@ bool mustDefineSymbol(Dsymbol* s) // so they shouldn't end up in object code. assert(fd->type->ty == Tfunction); - TypeFunction* tf = (TypeFunction*) fd->type; // * If we define extra static constructors, static destructors // and unittests they'll get registered to run, and we won't // be calling them directly anyway. @@ -1706,7 +1700,7 @@ LLValue* makeLValue(Loc& loc, DValue* value) valuePointer = value->getRVal(); needsMemory = !DtoIsPassedByRef(valueType); } - else if (DVarValue* var = value->isVar()) { + else if (value->isVar()) { valuePointer = value->getLVal(); needsMemory = false; } diff --git a/gen/nested.cpp b/gen/nested.cpp index 8044d825..5b338397 100644 --- a/gen/nested.cpp +++ b/gen/nested.cpp @@ -303,7 +303,7 @@ LLValue* DtoNestedContext(Loc loc, Dsymbol* sym) return llvm::UndefValue::get(getVoidPtrType()); } if (nestedCtx == NCHybrid) { - class FuncDeclaration* fd = 0; + struct FuncDeclaration* fd = 0; #if DMDV2 if (AggregateDeclaration *ad = sym->isAggregateDeclaration()) // If sym is a nested struct or a nested class, pass the frame @@ -499,7 +499,7 @@ void DtoCreateNestedContext(FuncDeclaration* fd) { if (parfd->isStatic()) break; } - else if (ClassDeclaration* parcd = par->isClassDeclaration()) + else if (par->isClassDeclaration()) { // nothing needed } diff --git a/gen/statements.cpp b/gen/statements.cpp index 522cc1bc..0b929781 100644 --- a/gen/statements.cpp +++ b/gen/statements.cpp @@ -260,7 +260,7 @@ void IfStatement::toIR(IRState* p) Logger::cout() << "if conditional: " << *cond_val << '\n'; cond_val = DtoCast(loc, cond_e, Type::tbool)->getRVal(); } - LLValue* ifgoback = llvm::BranchInst::Create(ifbb, elsebb, cond_val, gIR->scopebb()); + llvm::BranchInst::Create(ifbb, elsebb, cond_val, gIR->scopebb()); // replace current scope gIR->scope() = IRScope(ifbb,elsebb); @@ -352,7 +352,7 @@ void WhileStatement::toIR(IRState* p) delete cond_e; // conditional branch - LLValue* ifbreak = llvm::BranchInst::Create(whilebodybb, endbb, cond_val, p->scopebb()); + llvm::BranchInst::Create(whilebodybb, endbb, cond_val, p->scopebb()); // rewrite scope gIR->scope() = IRScope(whilebodybb,endbb); @@ -412,7 +412,7 @@ void DoStatement::toIR(IRState* p) delete cond_e; // conditional branch - LLValue* ifbreak = llvm::BranchInst::Create(dowhilebb, endbb, cond_val, gIR->scopebb()); + llvm::BranchInst::Create(dowhilebb, endbb, cond_val, gIR->scopebb()); // rewrite the scope gIR->scope() = IRScope(endbb,oldend); @@ -520,7 +520,7 @@ void BreakStatement::toIR(IRState* p) // get the loop statement the label refers to Statement* targetLoopStatement = target->statement; ScopeStatement* tmp; - while(tmp = targetLoopStatement->isScopeStatement()) + while((tmp = targetLoopStatement->isScopeStatement())) targetLoopStatement = tmp->statement; // find the right break block and jump there @@ -577,7 +577,7 @@ void ContinueStatement::toIR(IRState* p) // get the loop statement the label refers to Statement* targetLoopStatement = target->statement; ScopeStatement* tmp; - while(tmp = targetLoopStatement->isScopeStatement()) + while((tmp = targetLoopStatement->isScopeStatement())) targetLoopStatement = tmp->statement; // find the right continue block and jump there @@ -1178,7 +1178,6 @@ void ForeachStatement::toIR(IRState* p) // what to iterate DValue* aggrval = aggr->toElem(p); - Type* aggrtype = aggr->type->toBasetype(); // get length and pointer LLValue* niters = DtoArrayLen(aggrval); @@ -1196,7 +1195,6 @@ void ForeachStatement::toIR(IRState* p) niters = gIR->ir->CreateBitCast(niters, keytype, "foreachtrunckey"); } - LLConstant* delta = 0; if (op == TOKforeach) { new llvm::StoreInst(zerokey, keyvar, p->scopebb()); } @@ -1231,7 +1229,6 @@ void ForeachStatement::toIR(IRState* p) p->scope() = IRScope(bodybb,nextbb); // get value for this iteration - LLConstant* zero = LLConstantInt::get(keytype,0,false); LLValue* loadedKey = p->ir->CreateLoad(keyvar,"tmp"); LLValue* gep = DtoGEP1(val,loadedKey); diff --git a/gen/toir.cpp b/gen/toir.cpp index f6830111..a5a99e24 100644 --- a/gen/toir.cpp +++ b/gen/toir.cpp @@ -681,7 +681,6 @@ DValue* AddExp::toElem(IRState* p) Type* t = type->toBasetype(); Type* e1type = e1->type->toBasetype(); - Type* e1next = e1type->nextOf() ? e1type->nextOf()->toBasetype() : NULL; Type* e2type = e2->type->toBasetype(); errorOnIllegalArrayOp(this, e1, e2); @@ -863,7 +862,6 @@ DValue* CallExp::toElem(IRState* p) DFuncValue* dfnval = fnval->isFunc(); // handle magic intrinsics (mapping to instructions) - bool va_intrinsic = false; if (dfnval && dfnval->func) { FuncDeclaration* fndecl = dfnval->func; @@ -1017,7 +1015,7 @@ DValue* AddrExp::toElem(IRState* p) fd->codegen(Type::sir); return new DFuncValue(fd, fd->ir.irFunc->func); } - else if (DImValue* im = v->isIm()) { + else if (v->isIm()) { Logger::println("is immediate"); return v; } @@ -1189,7 +1187,6 @@ DValue* DotVarExp::toElem(IRState* p) DValue* l = e1->toElem(p); - Type* t = type->toBasetype(); Type* e1type = e1->type->toBasetype(); //Logger::println("e1type=%s", e1type->toChars()); @@ -1335,7 +1332,6 @@ DValue* IndexExp::toElem(IRState* p) p->arrays.pop_back(); LLValue* zero = DtoConstUint(0); - LLValue* one = DtoConstUint(1); LLValue* arrptr = 0; if (e1type->ty == Tpointer) { @@ -1485,7 +1481,6 @@ DValue* CmpExp::toElem(IRState* p) DValue* r = e2->toElem(p); Type* t = e1->type->toBasetype(); - Type* e2t = e2->type->toBasetype(); LLValue* eval = 0; @@ -1610,8 +1605,6 @@ DValue* EqualExp::toElem(IRState* p) LLValue* rv = r->getRVal(); Type* t = e1->type->toBasetype(); - Type* e2t = e2->type->toBasetype(); - //assert(t == e2t); LLValue* eval = 0; @@ -1683,7 +1676,7 @@ DValue* PostExp::toElem(IRState* p) LOG_SCOPE; DValue* l = e1->toElem(p); - DValue* r = e2->toElem(p); + e2->toElem(p); LLValue* val = l->getRVal(); LLValue* post = 0; @@ -2305,7 +2298,7 @@ DValue* CommaExp::toElem(IRState* p) return new DVarValue(type, V); } - DValue* u = e1->toElem(p); + e1->toElem(p); DValue* v = e2->toElem(p); assert(e2->type == type); return v; @@ -2408,8 +2401,6 @@ DValue* CatExp::toElem(IRState* p) Logger::print("CatExp::toElem: %s @ %s\n", toChars(), type->toChars()); LOG_SCOPE; - Type* t = type->toBasetype(); - bool arrNarr = e1->type->toBasetype() == e2->type->toBasetype(); // array ~ array diff --git a/gen/toobj.cpp b/gen/toobj.cpp index 4d3517bd..e9765e4e 100644 --- a/gen/toobj.cpp +++ b/gen/toobj.cpp @@ -812,5 +812,5 @@ void Module::genmoduleinfo() std::vector appendInits(1, magicinit); LLConstant* appendInit = LLConstantArray::get(appendArrTy, appendInits); std::string appendName("llvm.global_ctors"); - llvm::GlobalVariable* appendVar = new llvm::GlobalVariable(*gIR->module, appendArrTy, true, llvm::GlobalValue::AppendingLinkage, appendInit, appendName); + new llvm::GlobalVariable(*gIR->module, appendArrTy, true, llvm::GlobalValue::AppendingLinkage, appendInit, appendName); } diff --git a/ir/irclass.cpp b/ir/irclass.cpp index 63496ea3..844cb08f 100644 --- a/ir/irclass.cpp +++ b/ir/irclass.cpp @@ -374,7 +374,6 @@ llvm::GlobalVariable * IrStruct::getInterfaceVtbl(BaseClass * b, bool new_instan // start with the interface info VarDeclarationIter interfaces_idx(ClassDeclaration::classinfo->fields, 3); - Type* first = interfaces_idx->type->nextOf()->pointerTo(); // index into the interfaces array llvm::Constant* idxs[2] = { @@ -475,8 +474,6 @@ LLConstant * IrStruct::getClassInfoInterfaces() const LLType* voidptrptr_type = DtoType( Type::tvoid->pointerTo()->pointerTo()); - const LLType* our_type = stripModifiers(type)->irtype->isClass()->getPA().get(); - for (size_t i = 0; i < n; ++i) { BaseClass* it = interfacesWithVtbls[i]; diff --git a/ir/irtypefunction.h b/ir/irtypefunction.h index d14f4af9..d987c6c6 100644 --- a/ir/irtypefunction.h +++ b/ir/irtypefunction.h @@ -3,7 +3,7 @@ #include "ir/irtype.h" -class IrFuncTy; +struct IrFuncTy; /// class IrTypeFunction : public IrType