[llvm] [llvm-strip] Remove empty SHT_GROUP sections. (PR #97204)

Thorsten Schütt via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 30 07:45:38 PDT 2024


================
@@ -2206,8 +2206,16 @@ Error Object::removeSections(
   // Transfer removed sections into the Object RemovedSections container for use
   // later.
   std::move(Iter, Sections.end(), std::back_inserter(RemovedSections));
-  // Now finally get rid of them all together.
+  // Now get rid of them all together.
   Sections.erase(Iter, std::end(Sections));
+
+  // Finally iterate over all sections and erase empty SHT_GROUP sections.
+  for (auto Iter = Sections.begin(); Iter != Sections.end(); ++Iter) {
----------------
tschuett wrote:

At least for the for loop, I am not convinced that braces are needed. Furthermore:
https://llvm.org/docs/CodingStandards.html#don-t-evaluate-end-every-time-through-a-loop

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


More information about the llvm-commits mailing list