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

Greg Clayton via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 9 10:04:24 PST 2017


clayborg added a comment.

If "StartLine" is actually DW_AT_decl_line, then I would suggest calling it "DeclLine". See other inlined comments.



================
Comment at: include/llvm/DebugInfo/DIContext.h:37
   uint32_t Column;
+  uint32_t StartLine;
 
----------------
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.


================
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 =
----------------
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.


https://reviews.llvm.org/D27962





More information about the llvm-commits mailing list