Remove unused lambda captures. NFC

llvm-svn: 291916
This commit is contained in:
Malcolm Parsons 2017-01-13 17:12:16 +00:00
parent 5178363687
commit 17d266bc96
13 changed files with 24 additions and 24 deletions

View 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);
});

View 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);
};

View 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.

View 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;

View 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;

View 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.

View 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));
};

View 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;

View 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;

View 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());
});
}

View 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));
}))

View File

@ -87,6 +87,7 @@ protected:
EXPECT_TRUE(convStatus);
return EnvStorage.back().c_str();
#else
(void)this;
return Var;
#endif
};

View 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;
});