summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlujinwangnv <143145775+lujinwangnv@users.noreply.github.com>2025-05-23 14:42:01 -0700
committerGitHub <noreply@github.com>2025-05-23 21:42:01 +0000
commit554be7a5f990df19a21db10b4e5dc0285cbe8168 (patch)
tree6c878fc1259e47e69b65ae6c0d244c675e16bd7a
parent57c3f938221c427b78da7087f8a832ba4a271a7c (diff)
List all source files in debug source file list (#7203)
* List all source files in debug source file list The source file which does not participate in the line table is missing from the debug source file list. Always copy IRDebugSource instruction in linkIR() to fix the issue. * Update the code to address review * Add [[fallthrough]]
-rw-r--r--source/slang/slang-ir-link.cpp38
1 files changed, 23 insertions, 15 deletions
diff --git a/source/slang/slang-ir-link.cpp b/source/slang/slang-ir-link.cpp
index a84390f14..29a42b73c 100644
--- a/source/slang/slang-ir-link.cpp
+++ b/source/slang/slang-ir-link.cpp
@@ -2146,26 +2146,34 @@ LinkedIR linkIR(CodeGenContext* codeGenContext)
}
}
- // Bindings for global generic parameters are currently represented
- // as stand-alone global-scope instructions in the IR module for
- // `SpecializedComponentType`s. These instructions are required for
- // correct codegen, and so we must make sure to copy them all over,
- // even though they are not directly referenced.
- //
- // TODO: We should change these to decorations, akin to how
- // `[bindExistentialSlots(...)]` works, so that they can be attached
- // to the relevant parameters and cloned via `cloneExtraDecorations`.
- // In the long run we do not want to *ever* iterate over all the
- // instructions in all the input modules.
- //
-
+ // Clone additional insts that should be included in the linked IR module
+ // even if they are not being directly referenced.
for (IRModule* irModule : userModules)
{
for (auto inst : irModule->getGlobalInsts())
{
- if (auto bindInst = as<IRBindGlobalGenericParam>(inst))
+ switch (inst->getOp())
{
- cloneValue(context, bindInst);
+ default:
+ break;
+ case kIROp_BindGlobalGenericParam:
+ // Bindings for global generic parameters are currently represented
+ // as stand-alone global-scope instructions in the IR module for
+ // `SpecializedComponentType`s. These instructions are required for
+ // correct codegen, and so we must make sure to copy them all over,
+ // even though they are not directly referenced.
+ //
+ // TODO: We should change these to decorations, akin to how
+ // `[bindExistentialSlots(...)]` works, so that they can be attached
+ // to the relevant parameters and cloned via `cloneExtraDecorations`.
+ // In the long run we do not want to *ever* iterate over all the
+ // instructions in all the input modules.
+ [[fallthrough]];
+ case kIROp_DebugSource:
+ // Need to list all source files in the debug source file list,
+ // regardless if the source files participate in the line table or not.
+ cloneValue(context, inst);
+ break;
}
}
}