[PATCH] D54361: [ELF] .gdb_index: fix CuOff when a .debug_info section contains more than 1 CU
Rui Ueyama via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Nov 11 22:21:38 PST 2018
ruiu added inline comments.
================
Comment at: ELF/SyntheticSections.cpp:2426-2427
+ for (const DWARFDebugPubTable::Set &Set : Table.getData()) {
+ // The CU offset should be added to I when the entry is written into the
+ // constant pool.
+ uint32_t I =
----------------
Not sure if I understand this comment, because this comment explains only the tricky part of the code but doesn't explain the normal condition. I'd just explain what I represents and don't focus too much on the detail.
================
Comment at: ELF/SyntheticSections.cpp:2429
+ uint32_t I =
+ std::lower_bound(CUs.begin(), CUs.end(), Set.Offset,
+ [](const GdbIndexSection::CuEntry &CU,
----------------
Can you use a regular for loop instead of std::lower_bound? I think std::lower_bound with a lambda is not very easy to read because because a lambda of the third argument takes two arguments, even though `Off` is actually just Set.Offset in this case.
Repository:
rLLD LLVM Linker
https://reviews.llvm.org/D54361
More information about the llvm-commits
mailing list