diff options
| author | Mukund Keshava <mkeshava@nvidia.com> | 2025-05-11 02:29:37 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-10 20:59:37 +0000 |
| commit | 083eecee3f56b90c7011895f53aaafa9db15856e (patch) | |
| tree | a0a18f0905f2884374ee351713fe77af0843f679 /source/slang/slang-lower-to-ir.cpp | |
| parent | 48203ea02250ba517f749a222092f091d9bef15e (diff) | |
Add debug information for slang inling (#6621)
Diffstat (limited to 'source/slang/slang-lower-to-ir.cpp')
| -rw-r--r-- | source/slang/slang-lower-to-ir.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/source/slang/slang-lower-to-ir.cpp b/source/slang/slang-lower-to-ir.cpp index 2271e750e..c58eed1c1 100644 --- a/source/slang/slang-lower-to-ir.cpp +++ b/source/slang/slang-lower-to-ir.cpp @@ -11011,6 +11011,31 @@ struct DeclLoweringVisitor : DeclVisitor<DeclLoweringVisitor, LoweredValInfo> } } + // Add debugfunction decoration and emit debug function. This + // is needed for emitting debug information + auto nameHint = irFunc->findDecoration<IRNameHintDecoration>(); + IRStringLit* nameOperand = nameHint ? as<IRStringLit>(nameHint->getNameOperand()) : nullptr; + if (nameOperand) + { + getBuilder()->setInsertInto(getBuilder()->getModule()->getModuleInst()); + + auto locationDecor = irFunc->findDecoration<IRDebugLocationDecoration>(); + IRInst* debugType = irFunc->getDataType(); + + if (locationDecor && debugType) + { + auto debugFuncCallee = getBuilder()->emitDebugFunction( + nameOperand, + locationDecor->getLine(), + locationDecor->getCol(), + locationDecor->getSource(), + debugType); + + // Add a decoration to link the function to its debug function + getBuilder()->addDecoration(irFunc, kIROp_DebugFunctionDecoration, debugFuncCallee); + } + } + // For convenience, ensure that any additional global // values that were emitted while outputting the function // body appear before the function itself in the list |
