diff options
author | Vladislav Dzhidzhoev <vdzhidzhoev@accesssoftek.com> | 2023-07-18 14:22:46 +0200 |
---|---|---|
committer | Vladislav Dzhidzhoev <vdzhidzhoev@accesssoftek.com> | 2023-11-02 17:44:52 +0100 |
commit | 3b449bd46a11a55a40cbc0016a99b202fa05248e (patch) | |
tree | 2f43becc4e0cd830b15db5c075ff5b9c6a378610 /llvm/lib/IR/DebugInfo.cpp | |
parent | 98bd0d9dd2da0edec15b5eb7acb480c47c4594cc (diff) | |
download | llvm-3b449bd46a11a55a40cbc0016a99b202fa05248e.zip llvm-3b449bd46a11a55a40cbc0016a99b202fa05248e.tar.gz llvm-3b449bd46a11a55a40cbc0016a99b202fa05248e.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
Authored-by: Kristina Bessonova <kbessonova@accesssoftek.com>
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 390a27c..7c55f46 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; |