Fix compilation issues with MSVC 2010
(mostly by eliminating use of range-based for loops and std::tie)
diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp
index 21a04b0..20c58f7 100755
--- a/SPIRV/GlslangToSpv.cpp
+++ b/SPIRV/GlslangToSpv.cpp
@@ -688,8 +688,8 @@
void TGlslangToSpvTraverser::dumpSpv(std::vector<unsigned int>& out)
{
// finish off the entry-point SPV instruction by adding the Input/Output <id>
- for (auto it : iOSet)
- entryPoint->addIdOperand(it);
+ for (auto it = iOSet.cbegin(); it != iOSet.cend(); ++it)
+ entryPoint->addIdOperand(*it);
builder.dump(out);
}
diff --git a/SPIRV/InReadableOrder.cpp b/SPIRV/InReadableOrder.cpp
index 9180dc8..142d716 100644
--- a/SPIRV/InReadableOrder.cpp
+++ b/SPIRV/InReadableOrder.cpp
@@ -91,8 +91,9 @@
delayed_[continueBlock] = true;
}
}
- for (const auto succ : block->getSuccessors())
- visit(succ);
+ const auto successors = block->getSuccessors();
+ for (auto it = successors.cbegin(); it != successors.cend(); ++it)
+ visit(*it);
if (continueBlock) {
delayed_[continueBlock] = false;
visit(continueBlock);
diff --git a/SPIRV/SpvBuilder.cpp b/SPIRV/SpvBuilder.cpp
index c669944..aee4d32 100755
--- a/SPIRV/SpvBuilder.cpp
+++ b/SPIRV/SpvBuilder.cpp
@@ -1141,8 +1141,8 @@
void Builder::createNoResultOp(Op opCode, const std::vector<Id>& operands)
{
Instruction* op = new Instruction(opCode);
- for (auto operand : operands)
- op->addIdOperand(operand);
+ for (auto it = operands.cbegin(); it != operands.cend(); ++it)
+ op->addIdOperand(*it);
buildPoint->addInstruction(std::unique_ptr<Instruction>(op));
}
@@ -1197,8 +1197,8 @@
Id Builder::createOp(Op opCode, Id typeId, const std::vector<Id>& operands)
{
Instruction* op = new Instruction(getUniqueId(), typeId, opCode);
- for (auto operand : operands)
- op->addIdOperand(operand);
+ for (auto it = operands.cbegin(); it != operands.cend(); ++it)
+ op->addIdOperand(*it);
buildPoint->addInstruction(std::unique_ptr<Instruction>(op));
return op->getResultId();
@@ -2106,9 +2106,9 @@
type = getContainedTypeId(type);
// dereference each index
- for (auto deref : accessChain.indexChain) {
+ for (auto it = accessChain.indexChain.cbegin(); it != accessChain.indexChain.cend(); ++it) {
if (isStructType(type))
- type = getContainedTypeId(type, getConstantScalar(deref));
+ type = getContainedTypeId(type, getConstantScalar(*it));
else
type = getContainedTypeId(type);
}
@@ -2136,9 +2136,9 @@
out.push_back(0);
// Capabilities
- for (auto cap : capabilities) {
+ for (auto it = capabilities.cbegin(); it != capabilities.cend(); ++it) {
Instruction capInst(0, 0, OpCapability);
- capInst.addImmediateOperand(cap);
+ capInst.addImmediateOperand(*it);
capInst.dump(out);
}