mirror of
https://github.com/RPCSX/SPIRV-Tools.git
synced 2025-04-01 06:11:39 +00:00
Create const overloads for begin() and end() in Instruction.
This commit is contained in:
parent
923a4596b4
commit
b1b2cac2cf
@ -123,6 +123,8 @@ class Instruction {
|
||||
// Begin and end iterators for operands.
|
||||
iterator begin() { return operands_.begin(); }
|
||||
iterator end() { return operands_.end(); }
|
||||
const_iterator begin() const { return operands_.cbegin(); }
|
||||
const_iterator end() const { return operands_.cend(); }
|
||||
// Const begin and end iterators for operands.
|
||||
const_iterator cbegin() const { return operands_.cbegin(); }
|
||||
const_iterator cend() const { return operands_.cend(); }
|
||||
|
@ -126,8 +126,7 @@ uint32_t Module::ComputeIdBound() const {
|
||||
|
||||
ForEachInst(
|
||||
[&highest](const Instruction* inst) {
|
||||
// Use a const-cast just to access begin() and end() for the range-for.
|
||||
for (const auto& operand : *const_cast<Instruction*>(inst)) {
|
||||
for (const auto& operand : *inst) {
|
||||
if (spvIsIdType(operand.type)) {
|
||||
highest = std::max(highest, operand.words[0]);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user