aboutsummaryrefslogtreecommitdiff
path: root/source/val/validate_decorations.cpp
diff options
context:
space:
mode:
authorAlan Baker <alanbaker@google.com>2018-08-23 13:56:41 -0400
committerAlan Baker <alanbaker@google.com>2018-08-23 14:49:10 -0400
commit6d27a8350fbc339909834a6ef339c805cb1ab69b (patch)
treef6d0dd6fed9d133a35111766aea84c74579b5181 /source/val/validate_decorations.cpp
parentb4d3618f77eb49c9c7ec5a1fe6fc829fb5573194 (diff)
downloadSPIRV-Tools-6d27a8350fbc339909834a6ef339c805cb1ab69b.tar.gz
Fixing instances of iteration over unordered containers
* There were several instances found in the validator * validate_id.cpp * validate_decorations.cpp * validate_interfaces.cpp
Diffstat (limited to 'source/val/validate_decorations.cpp')
-rw-r--r--source/val/validate_decorations.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/source/val/validate_decorations.cpp b/source/val/validate_decorations.cpp
index 980e64c2..64fb5451 100644
--- a/source/val/validate_decorations.cpp
+++ b/source/val/validate_decorations.cpp
@@ -665,13 +665,12 @@ spv_result_t CheckDecorationsOfEntryPoints(ValidationState_t& vstate) {
}
spv_result_t CheckDescriptorSetArrayOfArrays(ValidationState_t& vstate) {
- for (const auto& def : vstate.all_definitions()) {
- const auto inst = def.second;
- if (SpvOpVariable != inst->opcode()) continue;
+ for (const auto& inst : vstate.ordered_instructions()) {
+ if (SpvOpVariable != inst.opcode()) continue;
// Verify this variable is a DescriptorSet
bool has_descriptor_set = false;
- for (const auto& decoration : vstate.id_decorations(def.first)) {
+ for (const auto& decoration : vstate.id_decorations(inst.id())) {
if (SpvDecorationDescriptorSet == decoration.dec_type()) {
has_descriptor_set = true;
break;
@@ -679,7 +678,7 @@ spv_result_t CheckDescriptorSetArrayOfArrays(ValidationState_t& vstate) {
}
if (!has_descriptor_set) continue;
- const auto* ptrInst = vstate.FindDef(inst->word(1));
+ const auto* ptrInst = vstate.FindDef(inst.word(1));
assert(SpvOpTypePointer == ptrInst->opcode());
// Check for a first level array
@@ -693,7 +692,7 @@ spv_result_t CheckDescriptorSetArrayOfArrays(ValidationState_t& vstate) {
const auto secondaryTypePtr = vstate.FindDef(typePtr->word(2));
if (SpvOpTypeRuntimeArray == secondaryTypePtr->opcode() ||
SpvOpTypeArray == secondaryTypePtr->opcode()) {
- return vstate.diag(SPV_ERROR_INVALID_ID, inst)
+ return vstate.diag(SPV_ERROR_INVALID_ID, &inst)
<< "Only a single level of array is allowed for descriptor "
"set variables";
}
@@ -783,10 +782,9 @@ void ComputeMemberConstraintsForArray(MemberConstraints* constraints,
}
spv_result_t CheckDecorationsOfBuffers(ValidationState_t& vstate) {
- for (const auto& def : vstate.all_definitions()) {
- const auto inst = def.second;
- const auto& words = inst->words();
- if (SpvOpVariable == inst->opcode()) {
+ for (const auto& inst : vstate.ordered_instructions()) {
+ const auto& words = inst.words();
+ if (SpvOpVariable == inst.opcode()) {
// For storage class / decoration combinations, see Vulkan 14.5.4 "Offset
// and Stride Assignment".
const auto storageClass = words[3];