summaryrefslogtreecommitdiff
path: root/source/slang/slang-lower-to-ir.cpp
diff options
context:
space:
mode:
authorLujin Wang <143145775+lujinwangnv@users.noreply.github.com>2025-09-18 10:37:14 -0700
committerGitHub <noreply@github.com>2025-09-18 17:37:14 +0000
commited9f42361e2f07a79fde39ded9e57473d5fac39f (patch)
tree1c3523d09781d4493c553fa7664d8ece0edf02a3 /source/slang/slang-lower-to-ir.cpp
parent54faa55c0bd4c4beede7337a76ed3a56d1eb4f15 (diff)
Fix DebugCompilationUnit to reference main shader file instead of header files (#7957)
This PR implements the requested fix for issue #7923 where DebugCompilationUnit incorrectly referenced header files instead of the main shader file. ## Summary - Modified IRDebugSource to include isIncludedFile flag as third operand - Updated emitDebugSource function to accept and pass the included file flag - Updated call sites to use source->isIncludedFile() from SourceFile class - Modified SPIR-V emission to only create DebugCompilationUnit for non-included files ## Test Results The fix has been verified with the provided reproducer code. The SPIR-V output now correctly shows DebugCompilationUnit referencing the main shader file instead of header files. Generated with [Claude Code](https://claude.ai/code) --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Lujin Wang <lujinwangnv@users.noreply.github.com> Co-authored-by: Claude Code <claude@anthropic.com> Co-authored-by: slangbot <ellieh+slangbot@nvidia.com> Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
Diffstat (limited to 'source/slang/slang-lower-to-ir.cpp')
-rw-r--r--source/slang/slang-lower-to-ir.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/source/slang/slang-lower-to-ir.cpp b/source/slang/slang-lower-to-ir.cpp
index 3fbf0bda9..792848ce6 100644
--- a/source/slang/slang-lower-to-ir.cpp
+++ b/source/slang/slang-lower-to-ir.cpp
@@ -7486,7 +7486,7 @@ IRInst* getOrEmitDebugSource(IRGenContext* context, PathInfo path)
content = UnownedStringSlice((char*)outBlob->getBufferPointer(), outBlob->getBufferSize());
IRBuilder builder(*context->irBuilder);
builder.setInsertInto(context->irBuilder->getModule());
- auto debugSrcInst = builder.emitDebugSource(path.foundPath.getUnownedSlice(), content);
+ auto debugSrcInst = builder.emitDebugSource(path.foundPath.getUnownedSlice(), content, false);
context->shared->mapSourcePathToDebugSourceInst[path.foundPath] = debugSrcInst;
return debugSrcInst;
}
@@ -12130,7 +12130,8 @@ RefPtr<IRModule> generateIRForTranslationUnit(
{
auto debugSource = builder->emitDebugSource(
source->getPathInfo().getMostUniqueIdentity().getUnownedSlice(),
- source->getContent());
+ source->getContent(),
+ source->isIncludedFile());
context->shared->mapSourceFileToDebugSourceInst.add(source, debugSource);
}
}