diff options
author | Vladislav Dzhidzhoev <vdzhidzhoev@accesssoftek.com> | 2023-07-18 14:22:46 +0200 |
---|---|---|
committer | Vladislav Dzhidzhoev <vdzhidzhoev@accesssoftek.com> | 2023-09-26 23:07:29 +0400 |
commit | f8aab289b5549086062588fba627b0e4d3a5ab15 (patch) | |
tree | e9b8b68c9f7cd6fe638d5f33bb9467dc7dfe7033 /llvm/lib/IR/DebugInfo.cpp | |
parent | ea7f43ec14c5522cec7b787c5fc3c323f7459e89 (diff) | |
download | llvm-f8aab289b5549086062588fba627b0e4d3a5ab15.zip llvm-f8aab289b5549086062588fba627b0e4d3a5ab15.tar.gz llvm-f8aab289b5549086062588fba627b0e4d3a5ab15.tar.bz2 |
[DebugMetadata][DwarfDebug] Support function-local types in lexical block scopes (4/7)
RFC https://discourse.llvm.org/t/rfc-dwarfdebug-fix-and-improve-handling-imported-entities-types-and-static-local-in-subprogram-and-lexical-block-scopes/68544
Similar to imported declarations, the patch tracks function-local types in
DISubprogram's 'retainedNodes' field. DwarfDebug is adjusted in accordance with
the aforementioned metadata change and provided a support of function-local
types scoped within a lexical block.
The patch assumes that DICompileUnit's 'enums field' no longer tracks local
types and DwarfDebug would assert if any locally-scoped types get placed there.
Reviewed By: jmmartinez
Differential Revision: https://reviews.llvm.org/D144006
Diffstat (limited to 'llvm/lib/IR/DebugInfo.cpp')
-rw-r--r-- | llvm/lib/IR/DebugInfo.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp index 48b5501..f95388c 100644 --- a/llvm/lib/IR/DebugInfo.cpp +++ b/llvm/lib/IR/DebugInfo.cpp @@ -267,6 +267,12 @@ void DebugInfoFinder::processSubprogram(DISubprogram *SP) { processType(TVal->getType()); } } + + for (auto *N : SP->getRetainedNodes()) { + if (auto *Var = dyn_cast<DILocalVariable>(N)) { + processLocalVariable(Var); + } + } } void DebugInfoFinder::processVariable(const Module &M, @@ -275,7 +281,10 @@ void DebugInfoFinder::processVariable(const Module &M, if (!N) return; - auto *DV = dyn_cast<DILocalVariable>(N); + processLocalVariable(dyn_cast<DILocalVariable>(N)); +} + +void DebugInfoFinder::processLocalVariable(DILocalVariable *DV) { if (!DV) return; |