KhronosGroup / KhronosGroup/SPIRV-Tools

Properly define the members of `spv_position_t`

Open
#1,810 1 comment 0 reactions 1 assignee Claimed by @s-perron View on GitHub
component:optimization
Dominant language
C++
Stars
1.4k
Forks
709
Avg merge
1d 22h
Merged PRs (30d)
28

Description

The message consumer takes a struct `spv_position_t` as a parameter to help indicate which part of the code caused the message to be generated. This is nice except that the members are not well defined and, as a result, are used inconsistently.

For example, the member `line`, is used to related the line number in the OpLline instruction associated with an instruction in replace invalid opcode (replace_invalide_opc.cpp:163). However, the ir loader, `line` is used as the number of the instruction in the spir-v file (ir_loader.cpp:42).

To make the matter more confusing, the validator uses the `index` member in the same way that the ir loader uses `line`. Then other places uses `index` to be the number of bytes into the binary file (linker.cpp:687).

We need to fix the design to make it more consistent.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.