diff options
| author | Lujin Wang <143145775+lujinwangnv@users.noreply.github.com> | 2025-06-04 22:55:11 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-05 05:55:11 +0000 |
| commit | 0c4c63b4a575f45f5dcf03f26b78becd36b0efca (patch) | |
| tree | e44bd4b5fc47b1f3b0b76d9a6ab27355fc02f6dd /source/compiler-core | |
| parent | 22ebf908f0efdabc0c2ebfad044f35677b6d6660 (diff) | |
Fix missing debug info for the included slang file (#7281)
* Fix missing debug info in the included slang file
Issue:
https://github.com/shader-slang/slang/issues/7271
Debug info including DebugFunction, DebugLocation, and DebugValue
are missing in IR for "#included" Slang shader file.
The included shader file was not added to TranslationUnit's source
file list, therefore mapSourceFileToDebugSourceInst.add() was not
called for the source in generateIRForTranslationUnit(), and later
mapSourceFileToDebugSourceInst.tryGetValue() could not get value
for the source to add DebugLocationDecoration, which led to missing
DebugFunction, DebugLocation and other debug info for the included
file in IR.
Adding the include file in TranslationUnit's source file list fixes
the issue.
* Add source file using PreprocessorHandler
Call _addSourceFile from FrontEndPreprocessorHandler::handleFileDependency.
* Just use FrontEndPreprocessorHandler
* Make _addSourceFile public
* format code
* Distingush the included source file
* Add m_includedFileSet to avoid adding dup file
HashSet<SourceFile*> m_includedFileSet;
---------
Co-authored-by: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com>
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
Diffstat (limited to 'source/compiler-core')
| -rw-r--r-- | source/compiler-core/slang-source-loc.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/source/compiler-core/slang-source-loc.h b/source/compiler-core/slang-source-loc.h index 674ed2076..b52f2e50d 100644 --- a/source/compiler-core/slang-source-loc.h +++ b/source/compiler-core/slang-source-loc.h @@ -331,6 +331,12 @@ public: m_sourceMapKind = sourceMapKind; } + /// Set the source file as an included file + void setIncludedFile() { m_included = true; } + + /// Check if the source file is an included file + bool isIncludedFile() { return m_included; } + /// Ctor SourceFile(SourceManager* sourceManager, const PathInfo& pathInfo, size_t contentSize); /// Dtor @@ -360,6 +366,9 @@ protected: ComPtr<IBoxValue<SourceMap>> m_sourceMap; // What kind of source map it is (if there is one) SourceMapKind m_sourceMapKind = SourceMapKind::Normal; + + // Indicate if the source file is an included file + bool m_included = false; }; enum class SourceLocType |
