]> granicus.if.org Git - llvm/commitdiff
Remove unused lambda captures. NFC
authorMalcolm Parsons <malcolm.parsons@gmail.com>
Fri, 13 Jan 2017 17:12:16 +0000 (17:12 +0000)
committerMalcolm Parsons <malcolm.parsons@gmail.com>
Fri, 13 Jan 2017 17:12:16 +0000 (17:12 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291916 91177308-0d34-0410-b5e6-96231b3b80d8

13 files changed:
include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h
lib/Analysis/ValueTracking.cpp
lib/Bitcode/Writer/ValueEnumerator.cpp
lib/CodeGen/LiveRangeCalc.cpp
lib/CodeGen/SelectionDAG/SelectionDAG.cpp
lib/Target/Hexagon/HexagonFrameLowering.cpp
lib/Target/Hexagon/HexagonRDFOpt.cpp
lib/Target/Hexagon/RDFGraph.cpp
lib/Target/PowerPC/PPCBranchSelector.cpp
lib/Target/TargetMachine.cpp
lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
unittests/Support/ProgramTest.cpp
unittests/Support/ThreadPool.cpp

index aa096478cd9e7ddcae4d2f30a2ffc8fa822031cf..7e7f7358938a4e6efab06d7529e69534666b2db0 100644 (file)
@@ -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<Function>(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<GlobalVariable>(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);
         });
 
index b79370baad10243d999fe1b013e27b6d687a43a3..244aa798a9cceacd1976a2c4346e3d5f12ea28d3 100644 (file)
@@ -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);
     };
 
index 5d5bfab58b81e11323fa66b8b3352f7acaa1cb55..cf905fc5899c601ddf17d33165ea32189284d1e0 100644 (file)
@@ -549,7 +549,7 @@ void ValueEnumerator::EnumerateFunctionLocalMetadata(
 void ValueEnumerator::dropFunctionFromMetadata(
     MetadataMapType::value_type &FirstMD) {
   SmallVector<const MDNode *, 64> 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.
index 0128376086281c1818a8c84baee50a47000aefd1..fd22c40487175ad0acf0d8a35eb10a5eb384adb2 100644 (file)
@@ -289,8 +289,7 @@ bool LiveRangeCalc::isDefOnEntry(LiveRange &LR, ArrayRef<SlotIndex> 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;
index e225ba8703b7785b6096c2ab04041d9aa8e87ed1..37b90859685b784db19d72901d3786e747f67c74 100644 (file)
@@ -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<ConstantSDNode>(E))
             return C->getAPIntValue().zextOrTrunc(BitWidth).isPowerOf2();
           return false;
index dd21d763359b8c71fc0bef30be03fc80fcdce58d..939631cbde276928a346e3921f30e56a79c63c0e 100644 (file)
@@ -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.
index 30640e19ebaca016cdf757cb8e4be2ce90880035..b3aba50b5625091e8f0283cbb6f83893495f262b 100644 (file)
@@ -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));
   };
 
index fa272ea1a76a4dee218a13c076651b6c7eaaa37e..ee8db96d40f4c84b56f38ad4aef3c92ef2736f4a 100644 (file)
@@ -276,7 +276,7 @@ raw_ostream &operator<< (raw_ostream &OS,
   MachineBasicBlock *BB = P.Obj.Addr->getCode();
   unsigned NP = BB->pred_size();
   std::vector<int> Ns;
-  auto PrintBBs = [&OS,&P] (std::vector<int> Ns) -> void {
+  auto PrintBBs = [&OS] (std::vector<int> Ns) -> void {
     unsigned N = Ns.size();
     for (int I : Ns) {
       OS << "BB#" << I;
index ae76386fdfb6ed1485bac2cc2b9c3855bb940b3e..b7d3154d000008e90ce02be0076ca46f70812236 100644 (file)
@@ -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;
index 8a6d28490e8c335a99a7f525c4c7ae6104c6cba1..f2c30a583e1b7bc009b739afbc9fdc093e37da16 100644 (file)
@@ -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());
   });
 }
index c44a393cf846dccddbab2934ba282280ccde1452..20fbcf4533d4ea26d8b5958d17edf626c9c9382b 100644 (file)
@@ -588,7 +588,7 @@ Vectorizer::collectInstructions(BasicBlock *BB) {
         continue;
 
       // Make sure all the users of a vector are constant-index extracts.
-      if (isa<VectorType>(Ty) && !all_of(LI->users(), [LI](const User *U) {
+      if (isa<VectorType>(Ty) && !all_of(LI->users(), [](const User *U) {
             const ExtractElementInst *EEI = dyn_cast<ExtractElementInst>(U);
             return EEI && isa<ConstantInt>(EEI->getOperand(1));
           }))
@@ -622,7 +622,7 @@ Vectorizer::collectInstructions(BasicBlock *BB) {
       if (TySize > VecRegSize / 2)
         continue;
 
-      if (isa<VectorType>(Ty) && !all_of(SI->users(), [SI](const User *U) {
+      if (isa<VectorType>(Ty) && !all_of(SI->users(), [](const User *U) {
             const ExtractElementInst *EEI = dyn_cast<ExtractElementInst>(U);
             return EEI && isa<ConstantInt>(EEI->getOperand(1));
           }))
index 886ead8305bc1cb32896697ae74cabe27fdd3588..3926ceb92b3ed5a598e8f0b186e82135557e433b 100644 (file)
@@ -87,6 +87,7 @@ protected:
       EXPECT_TRUE(convStatus);
       return EnvStorage.back().c_str();
 #else
+      (void)this;
       return Var;
 #endif
     };
index 8e03aacfb1e0360ff2184507a3c19c8cd84de23b..0da33ad50c0789c044f6593696e5a92d243712b4 100644 (file)
@@ -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;
       });