Fix disassembly line for adjacency validations. (#1751)

Previously the adjacency messages would output the last line of the file
as the disassembly. This is incorrect, as we have an instruction they
can be attached too. This CL fixes the messages to attach to the correct
line number.
This commit is contained in:
dan sinclair 2018-07-31 15:31:09 -04:00 committed by GitHub
parent b7afe4e7ae
commit dfb53f9f1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,7 +39,7 @@ spv_result_t ValidateAdjacency(ValidationState_t& _) {
case SpvOpLine:
break;
default:
return _.diag(SPV_ERROR_INVALID_DATA)
return _.diag(SPV_ERROR_INVALID_DATA, &(*i))
<< "OpPhi must appear before all non-OpPhi instructions "
<< "(except for OpLine, which can be mixed with OpPhi).";
}
@ -52,7 +52,7 @@ spv_result_t ValidateAdjacency(ValidationState_t& _) {
case SpvOpBranchConditional:
break;
default:
return _.diag(SPV_ERROR_INVALID_DATA)
return _.diag(SPV_ERROR_INVALID_DATA, &(*i))
<< "OpLoopMerge must immediately precede either an "
<< "OpBranch or OpBranchConditional instruction. "
<< "OpLoopMerge must be the second-to-last instruction in "
@ -67,7 +67,7 @@ spv_result_t ValidateAdjacency(ValidationState_t& _) {
case SpvOpSwitch:
break;
default:
return _.diag(SPV_ERROR_INVALID_DATA)
return _.diag(SPV_ERROR_INVALID_DATA, &(*i))
<< "OpSelectionMerge must immediately precede either an "
<< "OpBranchConditional or OpSwitch instruction. "
<< "OpSelectionMerge must be the second-to-last "