void Module::AddGlobalValue(SpvOp opcode, uint32_t result_id,
uint32_t type_id) {
- std::unique_ptr<ir::Instruction> newGlobal(new ir::Instruction(
- opcode, type_id, result_id, {}));
+ std::unique_ptr<ir::Instruction> newGlobal(
+ new ir::Instruction(opcode, type_id, result_id, {}));
AddGlobalValue(std::move(newGlobal));
}
void Module::ForEachInst(const std::function<void(const Instruction*)>& f,
bool run_on_debug_line_insts) const {
-#define DELEGATE(i) \
- static_cast<const Instruction*>(i.get()) \
- ->ForEachInst(f, run_on_debug_line_insts)
+#define DELEGATE(i) \
+ static_cast<const Instruction*>(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);
for (auto& i : annotations_) DELEGATE(i);
for (auto& i : types_values_) DELEGATE(i);
for (auto& i : functions_) {
- static_cast<const Function*>(i.get())
- ->ForEachInst(f, run_on_debug_line_insts);
+ static_cast<const Function*>(i.get())->ForEachInst(f,
+ run_on_debug_line_insts);
}
#undef DELEGATE
}
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);
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;
}