[llvm] Add support for DebugLexicalBlock. (PR #217965)

Juan Manuel Martinez CaamaƱo via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 27 03:07:04 PDT 2026


================
@@ -1484,6 +1575,21 @@ void SPIRVNonSemanticDebugHandler::emitNonSemanticGlobalDebugInfo(
       DebugTypeRegs[ST] = *FnTyReg;
   }
 
+  // Emit DebugLexicalBlock for each collected DINamespace, in parent-before-
+  // child order. Placed before any DINamespace-scoped entity (typedefs,
+  // function declarations, composite types, functions, global variables) so
+  // their Parent operand can reference an already-emitted DebugLexicalBlock.
+  // DINamespace never chains through a DISubprogram (DINamespace::getScope()
+  // returns DIScope, not DILocalScope), so this never depends on
+  // DebugFunctionRegs.
+  for (const DIScope *S : LexicalBlocks) {
----------------
jmmartinez wrote:

What do you thinkg about using `make_filter_range`?

```cpp
for(const DIScope *S : make_filter_range(LexicalBlocks, IsaPred<DINamespace>)) {
```

https://github.com/llvm/llvm-project/pull/217965


More information about the llvm-commits mailing list