KhronosGroup / glslang

Khronos-reference front end for GLSL/ESSL, partial front end for HLSL, and a SPIR-V generator.
Other
3k stars 828 forks source link

Fix function call line number for calls spanning multiple lines. #3641

Closed qingyuanzNV closed 3 months ago

qingyuanzNV commented 3 months ago

With this patch, for the following code with a multi-line function call:

add(
    inx + 1,
    inx + 2,
    inx + 3
);

Because argument evaluation changes the current source location tracked by the spv builder, we should reset it before creating OpFunctionCall (and other instructions emulating pass by reference). This avoid having function call instruction pointing to the line of last argument expression.