[PATCH] D44761: Fix PR36793
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 22 02:22:39 PDT 2018
grimar added a comment.
It turns out this can be simplified slightly. I attached the patch.
F5907496: patch.patch <https://reviews.llvm.org/F5907496>
================
Comment at: ELF/InputFiles.cpp:134
continue;
+ LineTables.push_back(LT);
----------------
Code above duplicates code from `DWARFContext::getLineTableForUnit`.
Since we now do not explicitly support case when there is no .debug_info (D44760),
we do not need to parse line tables explicitly here I think, so I would suggest the
different approach:
We could have `DWARFContext` as a member of ObjectFile. And here it could be just:
```
template <class ELFT> void ObjFile<ELFT>::initializeDwarf() {
Dwarf = llvm::make_unique<DWARFContext>(
llvm::make_unique<LLDDwarfObj<ELFT>>(this));
for (std::unique_ptr<DWARFCompileUnit> &CU : Dwarf->compile_units()) {
const DWARFDebugLine::LineTable *LT = Dwarf->getLineTableForUnit(CU.get());
...
```
================
Comment at: ELF/InputFiles.cpp:203
+ DILineInfoSpecifier::FileLineInfoKind::AbsoluteFilePath, Info);
+ if (Info.Line != 0)
+ return Info;
----------------
`getFileLineInfoForAddress` returns true on success according to specification.
It can be the following I think:
```
for (const llvm::DWARFDebugLine::LineTable *LT : LineTables)
if (LT->getFileLineInfoForAddress(
S->getOffsetInFile() + Offset, nullptr,
DILineInfoSpecifier::FileLineInfoKind::AbsoluteFilePath, Info))
return Info;
```
https://reviews.llvm.org/D44761
More information about the llvm-commits
mailing list