From 95aa52737d6b7053578aba772b7ccc7e80df6d28 Mon Sep 17 00:00:00 2001 From: qining Date: Wed, 9 Mar 2016 21:40:41 -0500 Subject: [PATCH] Change to traditional 'for' loop --- SPIRV/SpvBuilder.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/SPIRV/SpvBuilder.cpp b/SPIRV/SpvBuilder.cpp index 158c86b9..336d3de3 100644 --- a/SPIRV/SpvBuilder.cpp +++ b/SPIRV/SpvBuilder.cpp @@ -2137,14 +2137,21 @@ void Builder::eliminateDeadDecorations() { // Collect IDs defined in unreachable blocks. For each function, label the // reachable blocks first. Then for each unreachable block, collect the // result IDs of the instructions in it. - for (auto& f : module.getFunctions()) { + for (std::vector::const_iterator fi = module.getFunctions().cbegin(); + fi != module.getFunctions().cend(); fi++) { + Function* f = *fi; Block* entry = f->getEntryBlock(); inReadableOrder(entry, [&reachable_blocks](const Block* b) { reachable_blocks.insert(b); }); - for (auto& b : f->getBlocks()) { + for (std::vector::const_iterator bi = f->getBlocks().cbegin(); + bi != f->getBlocks().cend(); bi++) { + Block* b = *bi; if (!reachable_blocks.count(b)) { - for (auto& i : b->getInstructions()) { + for (std::vector >::const_iterator + ii = b->getInstructions().cbegin(); + ii != b->getInstructions().cend(); ii++) { + Instruction* i = ii->get(); unreachable_definitions.insert(i->getResultId()); } }