[PATCH] D45041: [DebugInfo] Construct DW_TAG_label DIEs from DbgLabels.

Hsiangkai Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 29 07:18:14 PDT 2018


HsiangKai created this revision.
HsiangKai added reviewers: rnk, chenwj.
Herald added a subscriber: JDevlieghere.

Repository:
  rL LLVM

https://reviews.llvm.org/D45041

Files:
  lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
  lib/CodeGen/AsmPrinter/DwarfCompileUnit.h


Index: lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
===================================================================
--- lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
+++ lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
@@ -87,6 +87,10 @@
   /// DbgVariable's DIE reference.
   DIE *constructVariableDIEImpl(const DbgVariable &DV, bool Abstract);
 
+  /// \brief Construct a DIE for the given DbgLabel without initializing the
+  /// DbgLabel's DIE reference.
+  DIE *constructLabelDIEImpl(const DbgLabel &DL);
+
   bool isDwoUnit() const override;
 
   DenseMap<const MDNode *, DIE *> &getAbstractSPDies() {
@@ -191,6 +195,9 @@
   DIE *constructVariableDIE(DbgVariable &DV, const LexicalScope &Scope,
                             DIE *&ObjectPointer);
 
+  /// constructLabelDIE - Construct a DIE for the given DbgLabel.
+  DIE *constructLabelDIE(DbgLabel &DL);
+
   /// A helper function to create children of a Scope DIE.
   DIE *createScopeChildrenDIE(LexicalScope *Scope,
                               SmallVectorImpl<DIE *> &Children,
Index: lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
===================================================================
--- lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
@@ -487,6 +487,13 @@
   return D;
 }
 
+/// constructLabelDIE - Construct a DIE for the given DbgLabel.
+DIE *DwarfCompileUnit::constructLabelDIE(DbgLabel &DL) {
+  auto D = constructLabelDIEImpl(DL);
+  DL.setDIE(*D);
+  return D;
+}
+
 DIE *DwarfCompileUnit::constructVariableDIEImpl(const DbgVariable &DV,
                                                 bool Abstract) {
   // Define variable debug information entry.
@@ -566,6 +573,12 @@
   return VariableDie;
 }
 
+DIE *DwarfCompileUnit::constructLabelDIEImpl(const DbgLabel &DL) {
+  // Define label debug information entry.
+  auto LabelDie = DIE::get(DIEValueAllocator, DL.getTag());
+  return LabelDie;
+}
+
 DIE *DwarfCompileUnit::constructVariableDIE(DbgVariable &DV,
                                             const LexicalScope &Scope,
                                             DIE *&ObjectPointer) {
@@ -677,6 +690,9 @@
   if (HasNonScopeChildren)
     *HasNonScopeChildren = !Children.empty();
 
+  for (DbgLabel *DL : DU->getScopeLabels().lookup(Scope))
+    Children.push_back(constructLabelDIE(*DL));
+
   for (LexicalScope *LS : Scope->getChildren())
     constructScopeDIE(LS, Children);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45041.140243.patch
Type: text/x-patch
Size: 2413 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180329/d9c2b38f/attachment.bin>


More information about the llvm-commits mailing list