[PATCH] D30033: [ELF] - Do not crash when discarding sections that are referenced by others.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 16 11:49:07 PST 2017


ruiu added inline comments.


================
Comment at: lld/trunk/ELF/LinkerScript.cpp:282
+    InputSection<ELFT> *IS = dyn_cast<InputSection<ELFT>>(S);
+    if (!IS || IS->DependentSections.empty())
+      continue;
----------------
You don't need to check if a container is empty before passing it to a for-each-ish function, just like you don't check for emptiness foo before doing `for (auto bar : foo)`.


Repository:
  rL LLVM

https://reviews.llvm.org/D30033





More information about the llvm-commits mailing list