[llvm] [NFC][AsmPrinter] Refactor constructVariableDIE (PR #66435)
Scott Linder via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 20 13:32:52 PDT 2023
================
@@ -740,232 +740,213 @@ DIE *DwarfCompileUnit::constructLexicalScopeDIE(LexicalScope *Scope) {
return ScopeDIE;
}
-/// constructVariableDIE - Construct a DIE for the given DbgVariable.
DIE *DwarfCompileUnit::constructVariableDIE(DbgVariable &DV, bool Abstract) {
- auto D = constructVariableDIEImpl(DV, Abstract);
- DV.setDIE(*D);
- return D;
+ auto *VariableDie = DIE::get(DIEValueAllocator, DV.getTag());
+ insertDIE(DV.getVariable(), VariableDie);
+ DV.setDIE(*VariableDie);
+ // Abstract variables don't get common attributes later, so apply them now.
+ if (Abstract) {
+ applyCommonDbgVariableAttributes(DV, *VariableDie);
+ } else {
+ std::visit(
+ [&](const auto &V) {
+ applyConcreteDbgVariableAttributes(V, DV, VariableDie);
----------------
slinder1 wrote:
A nice catch, which also brings it in-line with the "Common" attribute version!
https://github.com/llvm/llvm-project/pull/66435
More information about the llvm-commits
mailing list