diff options
author | dan sinclair <dj2@everburning.com> | 2018-08-01 09:52:16 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-01 09:52:16 -0400 |
commit | 2c5f1b01d8d9f97719b226c3212a1f7706b301df (patch) | |
tree | a23f4dca1c182793f4cc37a5d1bf4782056241f3 /source | |
parent | 3619de9ad526b2511c657ae7241ac5c3af3dee46 (diff) |
Update diag() calls in validate_cfg. (#1760)
This CL updates the diag() calls in validate_cfg to provide the
associated instruction. This fixes a couple places where we output the
last line of the file instead of the instruction as the disassembly.
Diffstat (limited to 'source')
-rw-r--r-- | source/val/validate_cfg.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/source/val/validate_cfg.cpp b/source/val/validate_cfg.cpp index 97dbcc0f..9ed45046 100644 --- a/source/val/validate_cfg.cpp +++ b/source/val/validate_cfg.cpp @@ -193,7 +193,7 @@ spv_result_t FindCaseFallThrough( continue; } - return _.diag(SPV_ERROR_INVALID_CFG) + return _.diag(SPV_ERROR_INVALID_CFG, target_block->label()) << "Case construct that targets " << _.getIdName(target_block->id()) << " has invalid branch to block " << _.getIdName(block->id()) @@ -244,7 +244,7 @@ spv_result_t StructuredSwitchChecks(const ValidationState_t& _, // OpSwitch must dominate all its case constructs. if (header->reachable() && target_block->reachable() && !header->dominates(*target_block)) { - return _.diag(SPV_ERROR_INVALID_CFG) + return _.diag(SPV_ERROR_INVALID_CFG, header->label()) << "Selection header " << _.getIdName(header->id()) << " does not dominate its case construct " << _.getIdName(target); } @@ -330,7 +330,7 @@ spv_result_t StructuredControlFlowChecks( uint32_t header_block; tie(back_edge_block, header_block) = back_edge; if (!function->IsBlockType(header_block, kBlockTypeLoop)) { - return _.diag(SPV_ERROR_INVALID_CFG) + return _.diag(SPV_ERROR_INVALID_CFG, _.FindDef(back_edge_block)) << "Back-edges (" << _.getIdName(back_edge_block) << " -> " << _.getIdName(header_block) << ") can only be formed between a block and a loop header."; |