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

Simon Que via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 9 11:35:56 PST 2017


sque added a comment.

I've added a unit test: https://reviews.llvm.org/D28428

I'll wait until that patch is approved before updating this one, which will modify that patch.



================
Comment at: include/llvm/DebugInfo/DIContext.h:37
   uint32_t Column;
+  uint32_t StartLine;
 
----------------
clayborg wrote:
> If this actually is always the value of DW_AT_decl_line, why not name it accordingly? "DeclLine" maybe instead of "StartLine"? StartLine seems confusing.
It depends on what this field is called in other formats. I only know that it is called "decl_line" in DWARF. Maybe this should be under the "DWARF-specific" section if we call it "DeclLine"


================
Comment at: lib/DebugInfo/DWARF/DWARFContext.cpp:442
 
-static bool getFunctionNameForAddress(DWARFCompileUnit *CU, uint64_t Address,
-                                      FunctionNameKind Kind,
-                                      std::string &FunctionName) {
-  if (Kind == FunctionNameKind::None)
-    return false;
+static uint32_t getStartLineFromDie(const DWARFDie &DIE, uint32_t FailValue) {
+  uint32_t StartLine =
----------------
clayborg wrote:
> aprantl wrote:
> > We're trying to get rid of all DWARF APIs that use special failure values right now. Could this return an Optional<uint32_t> instead?
> This should be added to DWARFDie as a member function:
> 
> ```
> Optional<uint32_t> DWARFDie::getDeclLine() const;
> ```
> 
> Other clients will want the DW_AT_decl_line and we shouldn't write the code more than once.
Good idea.


https://reviews.llvm.org/D27962





More information about the llvm-commits mailing list