From 3492cc63b89156a605a28fb2cc78244791286f59 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Wed, 17 May 2017 14:12:25 -0400 Subject: [PATCH] Remove unused this in lambda capture --- source/opt/module.cpp | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/source/opt/module.cpp b/source/opt/module.cpp index b5f5f0e..dd08ca0 100644 --- a/source/opt/module.cpp +++ b/source/opt/module.cpp @@ -68,8 +68,8 @@ uint32_t Module::GetGlobalValue(SpvOp opcode) const { void Module::AddGlobalValue(SpvOp opcode, uint32_t result_id, uint32_t type_id) { - std::unique_ptr newGlobal(new ir::Instruction( - opcode, type_id, result_id, {})); + std::unique_ptr newGlobal( + new ir::Instruction(opcode, type_id, result_id, {})); AddGlobalValue(std::move(newGlobal)); } @@ -91,9 +91,9 @@ void Module::ForEachInst(const std::function& f, void Module::ForEachInst(const std::function& f, bool run_on_debug_line_insts) const { -#define DELEGATE(i) \ - static_cast(i.get()) \ - ->ForEachInst(f, run_on_debug_line_insts) +#define DELEGATE(i) \ + static_cast(i.get())->ForEachInst( \ + f, run_on_debug_line_insts) for (auto& i : capabilities_) DELEGATE(i); for (auto& i : extensions_) DELEGATE(i); for (auto& i : ext_inst_imports_) DELEGATE(i); @@ -104,8 +104,8 @@ void Module::ForEachInst(const std::function& f, for (auto& i : annotations_) DELEGATE(i); for (auto& i : types_values_) DELEGATE(i); for (auto& i : functions_) { - static_cast(i.get()) - ->ForEachInst(f, run_on_debug_line_insts); + static_cast(i.get())->ForEachInst(f, + run_on_debug_line_insts); } #undef DELEGATE } @@ -118,7 +118,7 @@ void Module::ToBinary(std::vector* binary, bool skip_nop) const { binary->push_back(header_.bound); binary->push_back(header_.reserved); - auto write_inst = [this, binary, skip_nop](const Instruction* i) { + auto write_inst = [binary, skip_nop](const Instruction* i) { if (!(skip_nop && i->IsNop())) i->ToBinaryWithoutAttachedDebugInsts(binary); }; ForEachInst(write_inst, true); @@ -127,13 +127,15 @@ void Module::ToBinary(std::vector* binary, bool skip_nop) const { uint32_t Module::ComputeIdBound() const { uint32_t highest = 0; - ForEachInst([&highest](const Instruction* inst) { - for (const auto& operand : *inst) { - if (spvIsIdType(operand.type)) { - highest = std::max(highest, operand.words[0]); - } - } - }, true /* scan debug line insts as well */); + ForEachInst( + [&highest](const Instruction* inst) { + for (const auto& operand : *inst) { + if (spvIsIdType(operand.type)) { + highest = std::max(highest, operand.words[0]); + } + } + }, + true /* scan debug line insts as well */); return highest + 1; } -- 2.7.4