[PATCH] D27962: Get function start line number from DWARF info

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 16 10:42:57 PST 2017


dblaikie added inline comments.


================
Comment at: lib/DebugInfo/DWARF/DWARFDie.cpp:347-349
+  Optional<uint64_t> DeclLine;
+  if ((DeclLine = getAttributeValueAsUnsignedConstant(DW_AT_decl_line)))
+    return DeclLine;
----------------
Roll the variable declaration into the use:

  if (auto DeclLine = getAttributeAs...)
    return DeclLine;


================
Comment at: lib/DebugInfo/DWARF/DWARFDie.cpp:352-354
+  DWARFDie SpecDie = getAttributeValueAsReferencedDie(DW_AT_specification);
+  if (SpecDie && (DeclLine = SpecDie.getDeclLine()))
+    return DeclLine;
----------------
And here


================
Comment at: lib/DebugInfo/DWARF/DWARFDie.cpp:357-359
+  DWARFDie AbsDie = getAttributeValueAsReferencedDie(DW_AT_abstract_origin);
+  if (AbsDie && (DeclLine = AbsDie.getDeclLine()))
+    return DeclLine;
----------------
Similarly here:

if (auto AbsDie = ...)
  if (auto DeclLine = ...)
    return DeclLine;


https://reviews.llvm.org/D27962





More information about the llvm-commits mailing list