[llvm] Omit .debug_aranges if it is empty (PR #99897)
Edd Dawson via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 22 09:57:32 PDT 2024
================
@@ -3012,8 +3015,7 @@ void DwarfDebug::emitDebugARanges() {
for (auto &I : SectionMap) {
MCSection *Section = I.first;
SmallVector<SymbolCU, 8> &List = I.second;
- if (List.size() < 1)
- continue;
+ assert(!List.empty());
----------------
playstation-edd wrote:
After convincing myself that any `List` must be non-empty, I was confident that the early `return` could be placed above this loop. I replaced the dead check with an assert to avoid similar head scratching in future.
https://github.com/llvm/llvm-project/pull/99897
More information about the llvm-commits
mailing list