[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 17:21:48 PST 2017
clayborg added inline comments.
================
Comment at: lib/DebugInfo/DWARF/DWARFDie.cpp:347
+Optional<uint32_t> DWARFDie::getDeclLine() const {
+ uint32_t DeclLine = getAttributeValueAsUnsignedConstant(DW_AT_decl_line, -1U);
+ if (DeclLine != -1U)
----------------
Remove the -1U here, it will return an optional for you. You can just do:
```
if (auto DeclLine = getAttributeValueAsUnsignedConstant(DW_AT_decl_line))
return DeclLine;
```
================
Comment at: lib/DebugInfo/DWARF/DWARFDie.cpp:353-356
+ DeclLine =
+ SpecDie.getAttributeValueAsUnsignedConstant(DW_AT_decl_line, -1U);
+ if (DeclLine != -1U)
+ return DeclLine;
----------------
Recurse in case there is more than one specification or abstract origin:
```
if (auto DeclLine = SpecDie.getDeclLine())
return DeclLine;
```
================
Comment at: lib/DebugInfo/DWARF/DWARFDie.cpp:361-364
+ DeclLine =
+ AbsDie.getAttributeValueAsUnsignedConstant(DW_AT_decl_line, -1U);
+ if (DeclLine != -1U)
+ return DeclLine;
----------------
Ditto
https://reviews.llvm.org/D27962
More information about the llvm-commits
mailing list