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

Ellis Hoag via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 13 17:31:00 PDT 2021


ellis added a comment.

In D109703#2998350 <https://reviews.llvm.org/D109703#2998350>, @krisb wrote:

> In D109703#2998155 <https://reviews.llvm.org/D109703#2998155>, @ellis wrote:
>
>> I've added this to the added test case.
>>
>>   !18 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !4, entity: !19, line: 122)
>>   !19 = !DIGlobalVariable(name: "imported_static_var", scope: !6, file: !5, line: 3, type: !10, isLocal: false, isDefinition: true)
>
> Thank you for pointing to this! Just in case, do you have a C++ example, that reproduces the issue with imported static local declaration? I'm asking, cause in your example `DW_TAG_imported_declaration` has CU as a scope, while `DIGlobalVariable` is function-scoped. This looks a bit strange. I mean, `constructImportedEntityDIE()` called from `DwarfDebug::beginModule()` skips all local-scoped entities, and unless I'm missing something static locals shouldn't go here. Another call for  `constructImportedEntityDIE()` is from `DwarfCompileUnit::createScopeChildrenDIE` where I'd not expect any issue with parents.

No, I designed the test to hit that code path, but I should have found a C++ example to back it up. Thanks for looking into this!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109703



More information about the cfe-commits mailing list