From b1dbcd886a4b5597a839f299054b78b33fb2d6df Mon Sep 17 00:00:00 2001 From: Gabor Greif Date: Thu, 15 May 2008 10:04:30 +0000 Subject: [PATCH] Fix a bunch of 80col violations that arose from the Create API change. Tweak makefile targets to find these better. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51143 91177308-0d34-0410-b5e6-96231b3b80d8 --- Makefile.rules | 11 +++- examples/BrainF/BrainF.cpp | 7 +- lib/AsmParser/llvmAsmParser.y | 3 +- lib/Bitcode/Reader/BitcodeReader.cpp | 3 +- lib/ExecutionEngine/JIT/JIT.cpp | 7 +- lib/Linker/LinkModules.cpp | 6 +- lib/Transforms/IPO/GlobalOpt.cpp | 3 +- .../Instrumentation/RSProfiling.cpp | 4 +- lib/Transforms/Scalar/GVNPRE.cpp | 7 +- .../Scalar/InstructionCombining.cpp | 25 ++++--- lib/Transforms/Scalar/LoopRotation.cpp | 3 +- .../Scalar/TailRecursionElimination.cpp | 3 +- lib/Transforms/Utils/CodeExtractor.cpp | 3 +- lib/Transforms/Utils/InlineFunction.cpp | 3 +- lib/Transforms/Utils/LCSSA.cpp | 4 +- lib/Transforms/Utils/SimplifyCFG.cpp | 6 +- lib/VMCore/Constants.cpp | 11 ++-- lib/VMCore/Function.cpp | 3 +- lib/VMCore/Instructions.cpp | 65 +++++++++++-------- lib/VMCore/Mangler.cpp | 7 +- lib/VMCore/TypeSymbolTable.cpp | 4 +- lib/VMCore/Use.cpp | 6 +- tools/bugpoint/Miscompilation.cpp | 18 +++-- 23 files changed, 134 insertions(+), 78 deletions(-) diff --git a/Makefile.rules b/Makefile.rules index e28ccf187aa..55d4d1b7038 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -1738,10 +1738,17 @@ endif endif check-line-length: - @egrep -n '.{81}' $(Sources) + @echo searching for overlength lines in files: $(Sources) + @echo + @echo + @egrep -n '.{81}' $(Sources) /dev/null check-for-tabs: - @egrep -n ' ' $(Sources) + @echo searching for tabs in files: $(Sources) + @echo + @echo + @egrep -n ' ' $(Sources) /dev/null + check-footprint: @ls -l $(LibDir) | awk '\ BEGIN { sum = 0; } \ diff --git a/examples/BrainF/BrainF.cpp b/examples/BrainF/BrainF.cpp index bd6d5f2e56c..a79c44ef0f0 100644 --- a/examples/BrainF/BrainF.cpp +++ b/examples/BrainF/BrainF.cpp @@ -278,9 +278,10 @@ void BrainF::readloop(PHINode *phi, BasicBlock *oldbb, BasicBlock *testbb) { BasicBlock *bb_1 = BasicBlock::Create(label, brainf_func); builder->SetInsertPoint(bb_1); - //Make part of PHI instruction now, wait until end of loop to finish - PHINode *phi_0 = PHINode::Create(PointerType::getUnqual(IntegerType::Int8Ty), - headreg, testbb); + // Make part of PHI instruction now, wait until end of loop to finish + PHINode *phi_0 = + PHINode::Create(PointerType::getUnqual(IntegerType::Int8Ty), + headreg, testbb); phi_0->reserveOperandSpace(2); phi_0->addIncoming(curhead, bb_0); curhead = phi_0; diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y index 9a22c1bef5c..d63e3c9ae8e 100644 --- a/lib/AsmParser/llvmAsmParser.y +++ b/lib/AsmParser/llvmAsmParser.y @@ -2712,7 +2712,8 @@ BBTerminatorInst : PAL = PAListPtr::get(Attrs.begin(), Attrs.end()); // Create the InvokeInst - InvokeInst *II = InvokeInst::Create(V, Normal, Except, Args.begin(),Args.end()); + InvokeInst *II = InvokeInst::Create(V, Normal, Except, + Args.begin(), Args.end()); II->setCallingConv($2); II->setParamAttrs(PAL); $$ = II; diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp index 2d421b4b9e8..1fba6a48f61 100644 --- a/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/lib/Bitcode/Reader/BitcodeReader.cpp @@ -1485,7 +1485,8 @@ bool BitcodeReader::ParseFunctionBody(Function *F) { } } - I = InvokeInst::Create(Callee, NormalBB, UnwindBB, Ops.begin(), Ops.end()); + I = InvokeInst::Create(Callee, NormalBB, UnwindBB, + Ops.begin(), Ops.end()); cast(I)->setCallingConv(CCInfo); cast(I)->setParamAttrs(PAL); break; diff --git a/lib/ExecutionEngine/JIT/JIT.cpp b/lib/ExecutionEngine/JIT/JIT.cpp index e95c8a0996c..4b888ef018c 100644 --- a/lib/ExecutionEngine/JIT/JIT.cpp +++ b/lib/ExecutionEngine/JIT/JIT.cpp @@ -265,12 +265,13 @@ GenericValue JIT::runFunction(Function *F, Args.push_back(C); } - CallInst *TheCall = CallInst::Create(F, Args.begin(), Args.end(), "", StubBB); + CallInst *TheCall = CallInst::Create(F, Args.begin(), Args.end(), + "", StubBB); TheCall->setTailCall(); if (TheCall->getType() != Type::VoidTy) - ReturnInst::Create(TheCall, StubBB); // Return result of the call. + ReturnInst::Create(TheCall, StubBB); // Return result of the call. else - ReturnInst::Create(StubBB); // Just return void. + ReturnInst::Create(StubBB); // Just return void. // Finally, return the value returned by our nullary stub function. return runFunction(Stub, std::vector()); diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp index cf4ceaac504..fae7d9d748d 100644 --- a/lib/Linker/LinkModules.cpp +++ b/lib/Linker/LinkModules.cpp @@ -855,7 +855,8 @@ static bool LinkFunctionProtos(Module *Dest, const Module *Src, // We have a definition of the same name but different type in the // source module. Copy the prototype to the destination and replace // uses of the destination's prototype with the new prototype. - Function *NewDF = Function::Create(SF->getFunctionType(), SF->getLinkage(), + Function *NewDF = Function::Create(SF->getFunctionType(), + SF->getLinkage(), SF->getName(), Dest); CopyGVAttributes(NewDF, SF); @@ -891,7 +892,8 @@ static bool LinkFunctionProtos(Module *Dest, const Module *Src, } else if (!DF || SF->hasInternalLinkage() || DF->hasInternalLinkage()) { // Function does not already exist, simply insert an function signature // identical to SF into the dest module. - Function *NewDF = Function::Create(SF->getFunctionType(), SF->getLinkage(), + Function *NewDF = Function::Create(SF->getFunctionType(), + SF->getLinkage(), SF->getName(), Dest); CopyGVAttributes(NewDF, SF); diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp index e822d9c7b95..29a98cbb4c3 100644 --- a/lib/Transforms/IPO/GlobalOpt.cpp +++ b/lib/Transforms/IPO/GlobalOpt.cpp @@ -1082,7 +1082,8 @@ static void RewriteHeapSROALoadUser(LoadInst *Load, Instruction *LoadUser, GEPIdx.push_back(GEPI->getOperand(1)); GEPIdx.append(GEPI->op_begin()+3, GEPI->op_end()); - Value *NGEPI = GetElementPtrInst::Create(NewPtr, GEPIdx.begin(), GEPIdx.end(), + Value *NGEPI = GetElementPtrInst::Create(NewPtr, + GEPIdx.begin(), GEPIdx.end(), GEPI->getName(), GEPI); GEPI->replaceAllUsesWith(NGEPI); GEPI->eraseFromParent(); diff --git a/lib/Transforms/Instrumentation/RSProfiling.cpp b/lib/Transforms/Instrumentation/RSProfiling.cpp index 62c9ddd6b2c..7d166925071 100644 --- a/lib/Transforms/Instrumentation/RSProfiling.cpp +++ b/lib/Transforms/Instrumentation/RSProfiling.cpp @@ -381,8 +381,8 @@ Value* ProfilerRS::Translate(Value* v) { if (bb == &bb->getParent()->getEntryBlock()) TransCache[bb] = bb; //don't translate entry block else - TransCache[bb] = BasicBlock::Create("dup_" + bb->getName(), bb->getParent(), - NULL); + TransCache[bb] = BasicBlock::Create("dup_" + bb->getName(), + bb->getParent(), NULL); return TransCache[bb]; } else if (Instruction* i = dyn_cast(v)) { //we have already translated this diff --git a/lib/Transforms/Scalar/GVNPRE.cpp b/lib/Transforms/Scalar/GVNPRE.cpp index 80d74e6004b..90e6a717d1a 100644 --- a/lib/Transforms/Scalar/GVNPRE.cpp +++ b/lib/Transforms/Scalar/GVNPRE.cpp @@ -909,12 +909,13 @@ Value* GVNPRE::phi_translate(Value* V, BasicBlock* pred, BasicBlock* succ) { Instruction* newVal = 0; if (ShuffleVectorInst* S = dyn_cast(U)) newVal = new ShuffleVectorInst(newOp1, newOp2, newOp3, - S->getName()+".expr"); + S->getName() + ".expr"); else if (InsertElementInst* I = dyn_cast(U)) newVal = InsertElementInst::Create(newOp1, newOp2, newOp3, - I->getName()+".expr"); + I->getName() + ".expr"); else if (SelectInst* I = dyn_cast(U)) - newVal = SelectInst::Create(newOp1, newOp2, newOp3, I->getName()+".expr"); + newVal = SelectInst::Create(newOp1, newOp2, newOp3, + I->getName() + ".expr"); uint32_t v = VN.lookup_or_add(newVal); diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index bb4b7016dc4..2f4b1926d8c 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -8348,7 +8348,8 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) { if (AddOp != TI) std::swap(NewTrueOp, NewFalseOp); Instruction *NewSel = - SelectInst::Create(CondVal, NewTrueOp,NewFalseOp,SI.getName()+".p"); + SelectInst::Create(CondVal, NewTrueOp, + NewFalseOp, SI.getName() + ".p"); NewSel = InsertNewInstBefore(NewSel, SI); return BinaryOperator::createAdd(SubOp->getOperand(0), NewSel); @@ -8374,7 +8375,8 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) { if (OpToFold) { Constant *C = GetSelectFoldableConstant(TVI); Instruction *NewSel = - SelectInst::Create(SI.getCondition(), TVI->getOperand(2-OpToFold), C); + SelectInst::Create(SI.getCondition(), + TVI->getOperand(2-OpToFold), C); InsertNewInstBefore(NewSel, SI); NewSel->takeName(TVI); if (BinaryOperator *BO = dyn_cast(TVI)) @@ -8399,7 +8401,8 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) { if (OpToFold) { Constant *C = GetSelectFoldableConstant(FVI); Instruction *NewSel = - SelectInst::Create(SI.getCondition(), C, FVI->getOperand(2-OpToFold)); + SelectInst::Create(SI.getCondition(), C, + FVI->getOperand(2-OpToFold)); InsertNewInstBefore(NewSel, SI); NewSel->takeName(FVI); if (BinaryOperator *BO = dyn_cast(FVI)) @@ -8757,7 +8760,8 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) { } // Insert this value into the result vector. - Result = InsertElementInst::Create(Result, ExtractedElts[Idx], i, "tmp"); + Result = InsertElementInst::Create(Result, ExtractedElts[Idx], + i, "tmp"); InsertNewInstBefore(cast(Result), CI); } return CastInst::create(Instruction::BitCast, Result, CI.getType()); @@ -9090,7 +9094,8 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) { Instruction *NC; if (InvokeInst *II = dyn_cast(Caller)) { NC = InvokeInst::Create(Callee, II->getNormalDest(), II->getUnwindDest(), - Args.begin(), Args.end(), Caller->getName(), Caller); + Args.begin(), Args.end(), + Caller->getName(), Caller); cast(NC)->setCallingConv(II->getCallingConv()); cast(NC)->setParamAttrs(NewCallerPAL); } else { @@ -9331,7 +9336,8 @@ Instruction *InstCombiner::FoldPHIArgBinOpIntoPHI(PHINode &PN) { Value *InRHS = FirstInst->getOperand(1); PHINode *NewLHS = 0, *NewRHS = 0; if (LHSVal == 0) { - NewLHS = PHINode::Create(LHSType, FirstInst->getOperand(0)->getName()+".pn"); + NewLHS = PHINode::Create(LHSType, + FirstInst->getOperand(0)->getName() + ".pn"); NewLHS->reserveOperandSpace(PN.getNumOperands()/2); NewLHS->addIncoming(InLHS, PN.getIncomingBlock(0)); InsertNewInstBefore(NewLHS, PN); @@ -9339,7 +9345,8 @@ Instruction *InstCombiner::FoldPHIArgBinOpIntoPHI(PHINode &PN) { } if (RHSVal == 0) { - NewRHS = PHINode::Create(RHSType, FirstInst->getOperand(1)->getName()+".pn"); + NewRHS = PHINode::Create(RHSType, + FirstInst->getOperand(1)->getName() + ".pn"); NewRHS->reserveOperandSpace(PN.getNumOperands()/2); NewRHS->addIncoming(InRHS, PN.getIncomingBlock(0)); InsertNewInstBefore(NewRHS, PN); @@ -10864,8 +10871,8 @@ Instruction *InstCombiner::visitExtractElementInst(ExtractElementInst &EI) { cast(I->getOperand(0)->getType())->getAddressSpace(); Value *Ptr = InsertBitCastBefore(I->getOperand(0), PointerType::get(EI.getType(), AS),EI); - GetElementPtrInst *GEP = - GetElementPtrInst::Create(Ptr, EI.getOperand(1), I->getName() + ".gep"); + GetElementPtrInst *GEP = + GetElementPtrInst::Create(Ptr, EI.getOperand(1), I->getName()+".gep"); InsertNewInstBefore(GEP, EI); return new LoadInst(GEP); } diff --git a/lib/Transforms/Scalar/LoopRotation.cpp b/lib/Transforms/Scalar/LoopRotation.cpp index d8362a55006..08d557e983c 100644 --- a/lib/Transforms/Scalar/LoopRotation.cpp +++ b/lib/Transforms/Scalar/LoopRotation.cpp @@ -471,7 +471,8 @@ void LoopRotate::preserveCanonicalLoopForm(LPPassManager &LPM) { // Right now original pre-header has two successors, new header and // exit block. Insert new block between original pre-header and // new header such that loop's new pre-header has only one successor. - BasicBlock *NewPreHeader = BasicBlock::Create("bb.nph", OrigHeader->getParent(), + BasicBlock *NewPreHeader = BasicBlock::Create("bb.nph", + OrigHeader->getParent(), NewHeader); LoopInfo &LI = LPM.getAnalysis(); if (Loop *PL = LI.getLoopFor(OrigPreHeader)) diff --git a/lib/Transforms/Scalar/TailRecursionElimination.cpp b/lib/Transforms/Scalar/TailRecursionElimination.cpp index b9de782b270..61222f8732f 100644 --- a/lib/Transforms/Scalar/TailRecursionElimination.cpp +++ b/lib/Transforms/Scalar/TailRecursionElimination.cpp @@ -401,7 +401,8 @@ bool TailCallElim::ProcessReturningBlock(ReturnInst *Ret, BasicBlock *&OldEntry, Instruction *InsertPos = OldEntry->begin(); for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; ++I) { - PHINode *PN = PHINode::Create(I->getType(), I->getName()+".tr", InsertPos); + PHINode *PN = PHINode::Create(I->getType(), + I->getName() + ".tr", InsertPos); I->replaceAllUsesWith(PN); // Everyone use the PHI node now! PN->addIncoming(I, NewEntry); ArgumentPHIs.push_back(PN); diff --git a/lib/Transforms/Utils/CodeExtractor.cpp b/lib/Transforms/Utils/CodeExtractor.cpp index 54341196fb5..5cefb8db11e 100644 --- a/lib/Transforms/Utils/CodeExtractor.cpp +++ b/lib/Transforms/Utils/CodeExtractor.cpp @@ -641,7 +641,8 @@ ExtractCodeRegion(const std::vector &code) { Function *oldFunction = header->getParent(); // This takes place of the original loop - BasicBlock *codeReplacer = BasicBlock::Create("codeRepl", oldFunction, header); + BasicBlock *codeReplacer = BasicBlock::Create("codeRepl", oldFunction, + header); // The new function needs a root node because other nodes can branch to the // head of the region, but the entry node of a function cannot have preds. diff --git a/lib/Transforms/Utils/InlineFunction.cpp b/lib/Transforms/Utils/InlineFunction.cpp index 6c96785aa10..2ed335c95c1 100644 --- a/lib/Transforms/Utils/InlineFunction.cpp +++ b/lib/Transforms/Utils/InlineFunction.cpp @@ -532,7 +532,8 @@ bool llvm::InlineFunction(CallSite CS, CallGraph *CG, const TargetData *TD) { GR->eraseFromParent(); } } else { - PHINode *PHI = PHINode::Create(RTy, TheCall->getName(), AfterCallBB->begin()); + PHINode *PHI = PHINode::Create(RTy, TheCall->getName(), + AfterCallBB->begin()); PHIs.push_back(PHI); // Anything that used the result of the function call should now use the // PHI node as their operand. diff --git a/lib/Transforms/Utils/LCSSA.cpp b/lib/Transforms/Utils/LCSSA.cpp index a98733bea5e..5def5f99ad8 100644 --- a/lib/Transforms/Utils/LCSSA.cpp +++ b/lib/Transforms/Utils/LCSSA.cpp @@ -281,8 +281,8 @@ Value *LCSSA::GetValueForBlock(DomTreeNode *BB, Instruction *OrigInst, // Otherwise, the idom is the loop, so we need to insert a PHI node. Do so // now, then get values to fill in the incoming values for the PHI. - PHINode *PN = PHINode::Create(OrigInst->getType(), OrigInst->getName()+".lcssa", - BBN->begin()); + PHINode *PN = PHINode::Create(OrigInst->getType(), + OrigInst->getName() + ".lcssa", BBN->begin()); PN->reserveOperandSpace(std::distance(pred_begin(BBN), pred_end(BBN))); V = PN; diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp index b584e13876e..7396bb440e0 100644 --- a/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/lib/Transforms/Utils/SimplifyCFG.cpp @@ -802,7 +802,8 @@ static bool FoldValueComparisonIntoPredecessors(TerminatorInst *TI) { AddPredecessorToBlock(NewSuccessors[i], Pred, BB); // Now that the successors are updated, create the new Switch instruction. - SwitchInst *NewSI = SwitchInst::Create(CV, PredDefault, PredCases.size(), PTI); + SwitchInst *NewSI = SwitchInst::Create(CV, PredDefault, + PredCases.size(), PTI); for (unsigned i = 0, e = PredCases.size(); i != e; ++i) NewSI->addCase(PredCases[i].first, PredCases[i].second); @@ -1919,7 +1920,8 @@ bool llvm::SimplifyCFG(BasicBlock *BB) { if (!TrueWhenEqual) std::swap(DefaultBB, EdgeBB); // Create the new switch instruction now. - SwitchInst *New = SwitchInst::Create(CompVal, DefaultBB,Values.size(),BI); + SwitchInst *New = SwitchInst::Create(CompVal, DefaultBB, + Values.size(), BI); // Add all of the 'cases' to the switch instruction. for (unsigned i = 0, e = Values.size(); i != e; ++i) diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp index b327a6a855a..0f7ca0aaa08 100644 --- a/lib/VMCore/Constants.cpp +++ b/lib/VMCore/Constants.cpp @@ -539,9 +539,11 @@ class VISIBILITY_HIDDEN GetElementPtrConstantExpr : public ConstantExpr { GetElementPtrConstantExpr(Constant *C, const std::vector &IdxList, const Type *DestTy); public: - static GetElementPtrConstantExpr *Create(Constant *C, const std::vector &IdxList, + static GetElementPtrConstantExpr *Create(Constant *C, + const std::vector&IdxList, const Type *DestTy) { - return new(IdxList.size() + 1) GetElementPtrConstantExpr(C, IdxList, DestTy); + return new(IdxList.size() + 1) + GetElementPtrConstantExpr(C, IdxList, DestTy); } /// Transparently provide more efficient getOperand methods. DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value); @@ -1973,8 +1975,9 @@ Constant *ConstantExpr::getSelectTy(const Type *ReqTy, Constant *C, Constant *ConstantExpr::getGetElementPtrTy(const Type *ReqTy, Constant *C, Value* const *Idxs, unsigned NumIdx) { - assert(GetElementPtrInst::getIndexedType(C->getType(), Idxs, Idxs+NumIdx, true) && - "GEP indices invalid!"); + assert(GetElementPtrInst::getIndexedType(C->getType(), + Idxs, Idxs+NumIdx, true) + && "GEP indices invalid!"); if (Constant *FC = ConstantFoldGetElementPtr(C, (Constant**)Idxs, NumIdx)) return FC; // Fold a few common cases... diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp index 546cadb0f3b..9f7eefe1a6b 100644 --- a/lib/VMCore/Function.cpp +++ b/lib/VMCore/Function.cpp @@ -106,7 +106,8 @@ bool Argument::hasNoAliasAttr() const { /// it in its containing function. bool Argument::hasStructRetAttr() const { if (!isa(getType())) return false; - if (this != getParent()->arg_begin()) return false; // StructRet param must be first param + if (this != getParent()->arg_begin()) + return false; // StructRet param must be first param return getParent()->paramHasAttr(1, ParamAttr::StructRet); } diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp index ff565606138..473e9fac19c 100644 --- a/lib/VMCore/Instructions.cpp +++ b/lib/VMCore/Instructions.cpp @@ -421,7 +421,8 @@ void InvokeInst::init(Value *Fn, BasicBlock *IfNormal, BasicBlock *IfException, InvokeInst::InvokeInst(const InvokeInst &II) : TerminatorInst(II.getType(), Instruction::Invoke, - OperandTraits::op_end(this) - II.getNumOperands(), + OperandTraits::op_end(this) + - II.getNumOperands(), II.getNumOperands()) { setParamAttrs(II.getParamAttrs()); SubclassData = II.SubclassData; @@ -464,7 +465,8 @@ void InvokeInst::setDoesNotThrow(bool doesNotThrow) { ReturnInst::ReturnInst(const ReturnInst &RI) : TerminatorInst(Type::VoidTy, Instruction::Ret, - OperandTraits::op_end(this) - RI.getNumOperands(), + OperandTraits::op_end(this) + - RI.getNumOperands(), RI.getNumOperands()) { unsigned N = RI.getNumOperands(); if (N == 1) @@ -997,7 +999,8 @@ void GetElementPtrInst::init(Value *Ptr, Value *Idx) { GetElementPtrInst::GetElementPtrInst(const GetElementPtrInst &GEPI) : Instruction(reinterpret_cast(GEPI.getType()), GetElementPtr, - OperandTraits::op_end(this) - GEPI.getNumOperands(), + OperandTraits::op_end(this) + - GEPI.getNumOperands(), GEPI.getNumOperands()) { Use *OL = OperandList; Use *GEPIOL = GEPI.OperandList; @@ -1976,45 +1979,45 @@ bool CastInst::isCastable(const Type *SrcTy, const Type *DestTy) { unsigned DestBits = DestTy->getPrimitiveSizeInBits(); // 0 for ptr/vector // Run through the possibilities ... - if (DestTy->isInteger()) { // Casting to integral - if (SrcTy->isInteger()) { // Casting from integral + if (DestTy->isInteger()) { // Casting to integral + if (SrcTy->isInteger()) { // Casting from integral return true; - } else if (SrcTy->isFloatingPoint()) { // Casting from floating pt + } else if (SrcTy->isFloatingPoint()) { // Casting from floating pt return true; } else if (const VectorType *PTy = dyn_cast(SrcTy)) { - // Casting from vector + // Casting from vector return DestBits == PTy->getBitWidth(); - } else { // Casting from something else + } else { // Casting from something else return isa(SrcTy); } - } else if (DestTy->isFloatingPoint()) { // Casting to floating pt - if (SrcTy->isInteger()) { // Casting from integral + } else if (DestTy->isFloatingPoint()) { // Casting to floating pt + if (SrcTy->isInteger()) { // Casting from integral return true; - } else if (SrcTy->isFloatingPoint()) { // Casting from floating pt + } else if (SrcTy->isFloatingPoint()) { // Casting from floating pt return true; } else if (const VectorType *PTy = dyn_cast(SrcTy)) { - // Casting from vector + // Casting from vector return DestBits == PTy->getBitWidth(); - } else { // Casting from something else + } else { // Casting from something else return false; } } else if (const VectorType *DestPTy = dyn_cast(DestTy)) { - // Casting to vector + // Casting to vector if (const VectorType *SrcPTy = dyn_cast(SrcTy)) { - // Casting from vector + // Casting from vector return DestPTy->getBitWidth() == SrcPTy->getBitWidth(); - } else { // Casting from something else + } else { // Casting from something else return DestPTy->getBitWidth() == SrcBits; } - } else if (isa(DestTy)) { // Casting to pointer - if (isa(SrcTy)) { // Casting from pointer + } else if (isa(DestTy)) { // Casting to pointer + if (isa(SrcTy)) { // Casting from pointer return true; - } else if (SrcTy->isInteger()) { // Casting from integral + } else if (SrcTy->isInteger()) { // Casting from integral return true; - } else { // Casting from something else + } else { // Casting from something else return false; } - } else { // Casting to something else + } else { // Casting to something else return false; } } @@ -2806,8 +2809,12 @@ CastInst *FPToSIInst::clone() const { return new FPToSIInst(*this); } CastInst *PtrToIntInst::clone() const { return new PtrToIntInst(*this); } CastInst *IntToPtrInst::clone() const { return new IntToPtrInst(*this); } CastInst *BitCastInst::clone() const { return new BitCastInst(*this); } -CallInst *CallInst::clone() const { return new(getNumOperands()) CallInst(*this); } -SelectInst *SelectInst::clone() const { return new(getNumOperands()) SelectInst(*this); } +CallInst *CallInst::clone() const { + return new(getNumOperands()) CallInst(*this); +} +SelectInst *SelectInst::clone() const { + return new(getNumOperands()) SelectInst(*this); +} VAArgInst *VAArgInst::clone() const { return new VAArgInst(*this); } ExtractElementInst *ExtractElementInst::clone() const { @@ -2820,10 +2827,16 @@ ShuffleVectorInst *ShuffleVectorInst::clone() const { return new ShuffleVectorInst(*this); } PHINode *PHINode::clone() const { return new PHINode(*this); } -ReturnInst *ReturnInst::clone() const { return new(getNumOperands()) ReturnInst(*this); } -BranchInst *BranchInst::clone() const { return new(getNumOperands()) BranchInst(*this); } +ReturnInst *ReturnInst::clone() const { + return new(getNumOperands()) ReturnInst(*this); +} +BranchInst *BranchInst::clone() const { + return new(getNumOperands()) BranchInst(*this); +} SwitchInst *SwitchInst::clone() const { return new SwitchInst(*this); } -InvokeInst *InvokeInst::clone() const { return new(getNumOperands()) InvokeInst(*this); } +InvokeInst *InvokeInst::clone() const { + return new(getNumOperands()) InvokeInst(*this); +} UnwindInst *UnwindInst::clone() const { return new UnwindInst(); } UnreachableInst *UnreachableInst::clone() const { return new UnreachableInst();} GetResultInst *GetResultInst::clone() const { return new GetResultInst(*this); } diff --git a/lib/VMCore/Mangler.cpp b/lib/VMCore/Mangler.cpp index 0437508f394..50fa3c1885b 100644 --- a/lib/VMCore/Mangler.cpp +++ b/lib/VMCore/Mangler.cpp @@ -166,7 +166,8 @@ void Mangler::InsertName(GlobalValue *GV, } else { // If GV is external but the existing one is static, mangle the existing one if ((GV->hasExternalLinkage() || GV->hasDLLImportLinkage()) && - !(ExistingValue->hasExternalLinkage() || ExistingValue->hasDLLImportLinkage())) { + !(ExistingValue->hasExternalLinkage() + || ExistingValue->hasDLLImportLinkage())) { MangledGlobals.insert(ExistingValue); ExistingValue = GV; } else if ((GV->hasExternalLinkage() || @@ -208,6 +209,8 @@ Mangler::Mangler(Module &M, const char *prefix) std::map Names; for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) InsertName(I, Names); - for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) + for (Module::global_iterator I = M.global_begin(), E = M.global_end(); + I != E; + ++I) InsertName(I, Names); } diff --git a/lib/VMCore/TypeSymbolTable.cpp b/lib/VMCore/TypeSymbolTable.cpp index 91e4721c1b9..475d71949ff 100644 --- a/lib/VMCore/TypeSymbolTable.cpp +++ b/lib/VMCore/TypeSymbolTable.cpp @@ -64,7 +64,9 @@ Type* TypeSymbolTable::remove(iterator Entry) { // list... if (Result->isAbstract()) { #if DEBUG_ABSTYPE - cerr << "Removing abstract type from symtab" << Result->getDescription()<<"\n"; + cerr << "Removing abstract type from symtab" + << Result->getDescription() + << "\n"; #endif cast(Result)->removeAbstractTypeUser(this); } diff --git a/lib/VMCore/Use.cpp b/lib/VMCore/Use.cpp index 0672209bffa..d96a0e57fd4 100644 --- a/lib/VMCore/Use.cpp +++ b/lib/VMCore/Use.cpp @@ -1,4 +1,4 @@ -//===-- Use.cpp - Implement the Use class -------------------------------===// +//===-- Use.cpp - Implement the Use class ---------------------------------===// // // The LLVM Compiler Infrastructure // @@ -151,7 +151,9 @@ User *Use::getUser() const { //===----------------------------------------------------------------------===// Use *User::allocHungoffUses(unsigned N) const { - Use *Begin = static_cast(::operator new(sizeof(Use) * N + sizeof(AugmentedUse) - sizeof(Use))); + Use *Begin = static_cast(::operator new(sizeof(Use) * N + + sizeof(AugmentedUse) + - sizeof(Use))); Use *End = Begin + N; static_cast(End[-1]).ref = addTag(this, tagOne); return Use::initTags(Begin, End); diff --git a/tools/bugpoint/Miscompilation.cpp b/tools/bugpoint/Miscompilation.cpp index 536c3dbd744..8e677cbbb21 100644 --- a/tools/bugpoint/Miscompilation.cpp +++ b/tools/bugpoint/Miscompilation.cpp @@ -734,18 +734,22 @@ static void CleanupAndPrepareModules(BugDriver &BD, Module *&Test, // Resolve the call to function F via the JIT API: // // call resolver(GetElementPtr...) - CallInst *Resolver = CallInst::Create(resolverFunc, ResolverArgs.begin(), - ResolverArgs.end(), - "resolver", LookupBB); - // cast the result from the resolver to correctly-typed function - CastInst *CastedResolver = new BitCastInst(Resolver, - PointerType::getUnqual(F->getFunctionType()), "resolverCast", LookupBB); + CallInst *Resolver = + CallInst::Create(resolverFunc, ResolverArgs.begin(), + ResolverArgs.end(), "resolver", LookupBB); + + // Cast the result from the resolver to correctly-typed function. + CastInst *CastedResolver = + new BitCastInst(Resolver, + PointerType::getUnqual(F->getFunctionType()), + "resolverCast", LookupBB); // Save the value in our cache. new StoreInst(CastedResolver, Cache, LookupBB); BranchInst::Create(DoCallBB, LookupBB); - PHINode *FuncPtr = PHINode::Create(NullPtr->getType(), "fp", DoCallBB); + PHINode *FuncPtr = PHINode::Create(NullPtr->getType(), + "fp", DoCallBB); FuncPtr->addIncoming(CastedResolver, LookupBB); FuncPtr->addIncoming(CachedVal, EntryBB); -- 2.34.1