Improve line info for symbol access and assignment
This commit is contained in:
parent
fbabd37aca
commit
f8a2442a16
4 changed files with 683 additions and 367 deletions
|
|
@ -2004,6 +2004,10 @@ void TGlslangToSpvTraverser::dumpSpv(std::vector<unsigned int>& out)
|
|||
//
|
||||
void TGlslangToSpvTraverser::visitSymbol(glslang::TIntermSymbol* symbol)
|
||||
{
|
||||
// We update the line information even though no code might be generated here
|
||||
// This is helpful to yield correct lines for control flow instructions
|
||||
builder.setLine(symbol->getLoc().line, symbol->getLoc().getFilename());
|
||||
|
||||
SpecConstantOpModeGuard spec_constant_op_mode_setter(&builder);
|
||||
if (symbol->getType().isStruct())
|
||||
glslangTypeToIdMap[symbol->getType().getStruct()] = symbol->getId();
|
||||
|
|
@ -2155,6 +2159,9 @@ bool TGlslangToSpvTraverser::visitBinary(glslang::TVisit /* visit */, glslang::T
|
|||
node->getRight()->traverse(this);
|
||||
spv::Id rValue = accessChainLoad(node->getRight()->getType());
|
||||
|
||||
// reset line number for assignment
|
||||
builder.setLine(node->getLoc().line, node->getLoc().getFilename());
|
||||
|
||||
if (node->getOp() != glslang::EOpAssign) {
|
||||
// the left is also an r-value
|
||||
builder.setAccessChain(lValue);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue