[llvm] Omit .debug_aranges if it is empty (PR #99897)

Paul T Robinson via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 22 10:12:22 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());
----------------
pogo59 wrote:

I believe the assert is appropriate even without the early return. If ArangeLabels is empty, SectionMap will also be empty, and the loop body will not execute.

https://github.com/llvm/llvm-project/pull/99897


More information about the llvm-commits mailing list