Fix OpLine prepending OpFunction reports wrong file when #line is present

This commit is contained in:
Qingyuan Zheng
2022-09-06 23:57:18 -07:00
parent 7757cbebe4
commit c52b3d5075
5 changed files with 154 additions and 97 deletions

View File

@@ -2846,7 +2846,9 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
}
if (options.generateDebugInfo) {
const auto& loc = node->getLoc();
currentFunction->setDebugLineInfo(builder.getSourceFile(), loc.line, loc.column);
const char* sourceFileName = loc.getFilename();
spv::Id sourceFileId = sourceFileName ? builder.getStringId(sourceFileName) : builder.getSourceFile();
currentFunction->setDebugLineInfo(sourceFileId, loc.line, loc.column);
}
} else {
if (inEntryPoint)