[PATCH] D109703: [DebugInfo] Fix scope for local static variables

Kristina Bessonova via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 23 11:23:42 PDT 2021


krisb added a comment.

@dblaikie yeah, the problem(s) seemed easier and smaller :(

Basically, we have two issues with local scopes here:
(1) function-scoped entities like static variables, type definitions/typedefs, etc have incorrect (empty) parent DIE if the function containing them was inlined. We do not consider abstract SP as a possible parent DIE and try to create a new DIE for a function that doesn't exist. @ellis is working on this issue in [0] (for static vars) and [1] (for imported declarations).
(2) the same entities (static local vars, typedefs, etc) that should be scoped within a lexical block have a subprogram scope (in debug metadata) and parent DIE (in DWARF) instead. This is the issue I'm trying to fix in this patch, but for static variables only.

As a side effect, this patch fixes the issue with inlined functions for static vars (1) as well. But it seems the issues are not related and can be fixed separately.
And as now I've realized that static locals is not the only problem, this patch should implement a more generic solution to cover other entities. So, please, consider it as a WIP.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109703/new/

https://reviews.llvm.org/D109703



More information about the llvm-commits mailing list