[llvm-branch-commits] [llvm] [WIP][SPIRV][Debug Info] Add support for emitting DebugFunction debug info instructions (PR #183122)
Scott Linder via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Mar 2 13:50:38 PST 2026
================
@@ -373,8 +439,160 @@ bool SPIRVEmitNonSemanticDI::emitGlobalDI(MachineFunction &MF) {
return true;
}
+// Emits the SPIRV DebugFunction instruction for a given MachineFunction.
+bool SPIRVEmitNonSemanticDI::emitFunctionDI(MachineFunction &MF) {
+ const Function &F = MF.getFunction();
+
+ DISubprogram *SP = F.getSubprogram();
+ // DISubProgram is not available, don't translate
+ if (!SP) {
----------------
slinder1 wrote:
Nit: I'd drop the braces on these early returns (see https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements)
The function is already long, and these push things apart even more.
I might also vote for dropping some of the comments which describe something in the same terms as it is implemented.
For example I would change:
```cpp
// Get the scope from DISubProgram
DIScope *Scope = SP->getScope();
if (!Scope) {
return false;
}
```
To:
```cpp
DIScope *Scope = SP->getScope();
if (!Scope)
return false;
```
https://github.com/llvm/llvm-project/pull/183122
More information about the llvm-branch-commits
mailing list