From: Malcolm Parsons Date: Fri, 13 Jan 2017 17:12:16 +0000 (+0000) Subject: Remove unused lambda captures. NFC X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=60f78e3e923b3c7ef87867d89ecf7f19a88d90ce;p=llvm Remove unused lambda captures. NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291916 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h b/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h index aa096478cd9..7e7f7358938 100644 --- a/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h +++ b/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h @@ -376,7 +376,7 @@ private: // Initializers may refer to functions declared (but not defined) in this // module. Build a materializer to clone decls on demand. auto Materializer = createLambdaMaterializer( - [this, &LD, &GVsM](Value *V) -> Value* { + [&LD, &GVsM](Value *V) -> Value* { if (auto *F = dyn_cast(V)) { // Decls in the original module just get cloned. if (F->isDeclaration()) @@ -419,7 +419,7 @@ private: // Build a resolver for the globals module and add it to the base layer. auto GVsResolver = createLambdaResolver( - [this, &LD, LMId](const std::string &Name) { + [this, &LD](const std::string &Name) { if (auto Sym = LD.StubsMgr->findStub(Name, false)) return Sym; if (auto Sym = LD.findSymbol(BaseLayer, Name, false)) @@ -499,8 +499,8 @@ private: M->setDataLayout(SrcM.getDataLayout()); ValueToValueMapTy VMap; - auto Materializer = createLambdaMaterializer([this, &LD, &LMId, &M, - &VMap](Value *V) -> Value * { + auto Materializer = createLambdaMaterializer([&LD, &LMId, + &M](Value *V) -> Value * { if (auto *GV = dyn_cast(V)) return cloneGlobalVariableDecl(*M, *GV); @@ -546,12 +546,12 @@ private: // Create memory manager and symbol resolver. auto Resolver = createLambdaResolver( - [this, &LD, LMId](const std::string &Name) { + [this, &LD](const std::string &Name) { if (auto Sym = LD.findSymbol(BaseLayer, Name, false)) return Sym; return LD.ExternalSymbolResolver->findSymbolInLogicalDylib(Name); }, - [this, &LD](const std::string &Name) { + [&LD](const std::string &Name) { return LD.ExternalSymbolResolver->findSymbol(Name); }); diff --git a/lib/Analysis/ValueTracking.cpp b/lib/Analysis/ValueTracking.cpp index b79370baad1..244aa798a9c 100644 --- a/lib/Analysis/ValueTracking.cpp +++ b/lib/Analysis/ValueTracking.cpp @@ -1113,7 +1113,7 @@ static void computeKnownBitsFromOperator(const Operator *I, APInt &KnownZero, APInt::getHighBitsSet(BitWidth, ShiftAmt); }; - auto KOF = [BitWidth](const APInt &KnownOne, unsigned ShiftAmt) { + auto KOF = [](const APInt &KnownOne, unsigned ShiftAmt) { return APIntOps::lshr(KnownOne, ShiftAmt); }; @@ -1124,11 +1124,11 @@ static void computeKnownBitsFromOperator(const Operator *I, APInt &KnownZero, } case Instruction::AShr: { // (ashr X, C1) & C2 == 0 iff (-1 >> C1) & C2 == 0 - auto KZF = [BitWidth](const APInt &KnownZero, unsigned ShiftAmt) { + auto KZF = [](const APInt &KnownZero, unsigned ShiftAmt) { return APIntOps::ashr(KnownZero, ShiftAmt); }; - auto KOF = [BitWidth](const APInt &KnownOne, unsigned ShiftAmt) { + auto KOF = [](const APInt &KnownOne, unsigned ShiftAmt) { return APIntOps::ashr(KnownOne, ShiftAmt); }; diff --git a/lib/Bitcode/Writer/ValueEnumerator.cpp b/lib/Bitcode/Writer/ValueEnumerator.cpp index 5d5bfab58b8..cf905fc5899 100644 --- a/lib/Bitcode/Writer/ValueEnumerator.cpp +++ b/lib/Bitcode/Writer/ValueEnumerator.cpp @@ -549,7 +549,7 @@ void ValueEnumerator::EnumerateFunctionLocalMetadata( void ValueEnumerator::dropFunctionFromMetadata( MetadataMapType::value_type &FirstMD) { SmallVector Worklist; - auto push = [this, &Worklist](MetadataMapType::value_type &MD) { + auto push = [&Worklist](MetadataMapType::value_type &MD) { auto &Entry = MD.second; // Nothing to do if this metadata isn't tagged. diff --git a/lib/CodeGen/LiveRangeCalc.cpp b/lib/CodeGen/LiveRangeCalc.cpp index 01283760862..fd22c404871 100644 --- a/lib/CodeGen/LiveRangeCalc.cpp +++ b/lib/CodeGen/LiveRangeCalc.cpp @@ -289,8 +289,7 @@ bool LiveRangeCalc::isDefOnEntry(LiveRange &LR, ArrayRef Undefs, if (UndefOnEntry[BN]) return false; - auto MarkDefined = - [this,BN,&DefOnEntry,&UndefOnEntry] (MachineBasicBlock &B) -> bool { + auto MarkDefined = [BN, &DefOnEntry](MachineBasicBlock &B) -> bool { for (MachineBasicBlock *S : B.successors()) DefOnEntry[S->getNumber()] = true; DefOnEntry[BN] = true; diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index e225ba8703b..37b90859685 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -2745,7 +2745,7 @@ bool SelectionDAG::isKnownToBeAPowerOfTwo(SDValue Val) const { // Are all operands of a build vector constant powers of two? if (Val.getOpcode() == ISD::BUILD_VECTOR) - if (llvm::all_of(Val->ops(), [this, BitWidth](SDValue E) { + if (llvm::all_of(Val->ops(), [BitWidth](SDValue E) { if (ConstantSDNode *C = dyn_cast(E)) return C->getAPIntValue().zextOrTrunc(BitWidth).isPowerOf2(); return false; diff --git a/lib/Target/Hexagon/HexagonFrameLowering.cpp b/lib/Target/Hexagon/HexagonFrameLowering.cpp index dd21d763359..939631cbde2 100644 --- a/lib/Target/Hexagon/HexagonFrameLowering.cpp +++ b/lib/Target/Hexagon/HexagonFrameLowering.cpp @@ -1984,9 +1984,9 @@ void HexagonFrameLowering::optimizeSpillSlots(MachineFunction &MF, // class HaveRC and a new class NewRC. Return nullptr if a common class // cannot be found, otherwise return the resulting class. If HaveRC is // nullptr, assume that it is still unset. - auto getCommonRC = [&HRI] (const TargetRegisterClass *HaveRC, - const TargetRegisterClass *NewRC) - -> const TargetRegisterClass* { + auto getCommonRC = + [](const TargetRegisterClass *HaveRC, + const TargetRegisterClass *NewRC) -> const TargetRegisterClass * { if (HaveRC == nullptr || HaveRC == NewRC) return NewRC; // Different classes, both non-null. Pick the more general one. diff --git a/lib/Target/Hexagon/HexagonRDFOpt.cpp b/lib/Target/Hexagon/HexagonRDFOpt.cpp index 30640e19eba..b3aba50b562 100644 --- a/lib/Target/Hexagon/HexagonRDFOpt.cpp +++ b/lib/Target/Hexagon/HexagonRDFOpt.cpp @@ -94,7 +94,7 @@ struct HexagonDCE : public DeadCodeElimination { bool HexagonCP::interpretAsCopy(const MachineInstr *MI, EqualityMap &EM) { - auto mapRegs = [MI,&EM] (RegisterRef DstR, RegisterRef SrcR) -> void { + auto mapRegs = [&EM] (RegisterRef DstR, RegisterRef SrcR) -> void { EM.insert(std::make_pair(DstR, SrcR)); }; diff --git a/lib/Target/Hexagon/RDFGraph.cpp b/lib/Target/Hexagon/RDFGraph.cpp index fa272ea1a76..ee8db96d40f 100644 --- a/lib/Target/Hexagon/RDFGraph.cpp +++ b/lib/Target/Hexagon/RDFGraph.cpp @@ -276,7 +276,7 @@ raw_ostream &operator<< (raw_ostream &OS, MachineBasicBlock *BB = P.Obj.Addr->getCode(); unsigned NP = BB->pred_size(); std::vector Ns; - auto PrintBBs = [&OS,&P] (std::vector Ns) -> void { + auto PrintBBs = [&OS] (std::vector Ns) -> void { unsigned N = Ns.size(); for (int I : Ns) { OS << "BB#" << I; diff --git a/lib/Target/PowerPC/PPCBranchSelector.cpp b/lib/Target/PowerPC/PPCBranchSelector.cpp index ae76386fdfb..b7d3154d000 100644 --- a/lib/Target/PowerPC/PPCBranchSelector.cpp +++ b/lib/Target/PowerPC/PPCBranchSelector.cpp @@ -78,7 +78,7 @@ bool PPCBSel::runOnMachineFunction(MachineFunction &Fn) { BlockSizes.resize(Fn.getNumBlockIDs()); auto GetAlignmentAdjustment = - [TII](MachineBasicBlock &MBB, unsigned Offset) -> unsigned { + [](MachineBasicBlock &MBB, unsigned Offset) -> unsigned { unsigned Align = MBB.getAlignment(); if (!Align) return 0; diff --git a/lib/Target/TargetMachine.cpp b/lib/Target/TargetMachine.cpp index 8a6d28490e8..f2c30a583e1 100644 --- a/lib/Target/TargetMachine.cpp +++ b/lib/Target/TargetMachine.cpp @@ -198,7 +198,7 @@ CodeGenOpt::Level TargetMachine::getOptLevel() const { return OptLevel; } void TargetMachine::setOptLevel(CodeGenOpt::Level Level) { OptLevel = Level; } TargetIRAnalysis TargetMachine::getTargetIRAnalysis() { - return TargetIRAnalysis([this](const Function &F) { + return TargetIRAnalysis([](const Function &F) { return TargetTransformInfo(F.getParent()->getDataLayout()); }); } diff --git a/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp b/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp index c44a393cf84..20fbcf4533d 100644 --- a/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp +++ b/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp @@ -588,7 +588,7 @@ Vectorizer::collectInstructions(BasicBlock *BB) { continue; // Make sure all the users of a vector are constant-index extracts. - if (isa(Ty) && !all_of(LI->users(), [LI](const User *U) { + if (isa(Ty) && !all_of(LI->users(), [](const User *U) { const ExtractElementInst *EEI = dyn_cast(U); return EEI && isa(EEI->getOperand(1)); })) @@ -622,7 +622,7 @@ Vectorizer::collectInstructions(BasicBlock *BB) { if (TySize > VecRegSize / 2) continue; - if (isa(Ty) && !all_of(SI->users(), [SI](const User *U) { + if (isa(Ty) && !all_of(SI->users(), [](const User *U) { const ExtractElementInst *EEI = dyn_cast(U); return EEI && isa(EEI->getOperand(1)); })) diff --git a/unittests/Support/ProgramTest.cpp b/unittests/Support/ProgramTest.cpp index 886ead8305b..3926ceb92b3 100644 --- a/unittests/Support/ProgramTest.cpp +++ b/unittests/Support/ProgramTest.cpp @@ -87,6 +87,7 @@ protected: EXPECT_TRUE(convStatus); return EnvStorage.back().c_str(); #else + (void)this; return Var; #endif }; diff --git a/unittests/Support/ThreadPool.cpp b/unittests/Support/ThreadPool.cpp index 8e03aacfb1e..0da33ad50c0 100644 --- a/unittests/Support/ThreadPool.cpp +++ b/unittests/Support/ThreadPool.cpp @@ -90,7 +90,7 @@ TEST_F(ThreadPoolTest, AsyncBarrier) { ThreadPool Pool; for (size_t i = 0; i < 5; ++i) { - Pool.async([this, &checked_in, i] { + Pool.async([this, &checked_in] { waitForMainThread(); ++checked_in; }); @@ -154,7 +154,7 @@ TEST_F(ThreadPoolTest, PoolDestruction) { { ThreadPool Pool; for (size_t i = 0; i < 5; ++i) { - Pool.async([this, &checked_in, i] { + Pool.async([this, &checked_in] { waitForMainThread(); ++checked_in; });