[lld] r336814 - [ELF] - Simplify. NFCI.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 11 08:18:23 PDT 2018


Author: grimar
Date: Wed Jul 11 08:18:23 2018
New Revision: 336814

URL: http://llvm.org/viewvc/llvm-project?rev=336814&view=rev
Log:
[ELF] - Simplify. NFCI.

It does not look possible to end up with empty Sections
at this place. And this knowledge allows simplifying the code.

Modified:
    lld/trunk/ELF/Writer.cpp

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=336814&r1=336813&r2=336814&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Wed Jul 11 08:18:23 2018
@@ -1425,13 +1425,12 @@ template <class ELFT> void Writer<ELFT>:
     if (!Config->Relocatable && Config->EMachine == EM_ARM &&
         Sec->Type == SHT_ARM_EXIDX) {
 
-      if (!Sections.empty() && isa<ARMExidxSentinelSection>(Sections.back())) {
+      if (auto *Sentinel = dyn_cast<ARMExidxSentinelSection>(Sections.back())) {
         assert(Sections.size() >= 2 &&
                "We should create a sentinel section only if there are "
                "alive regular exidx sections.");
         // The last executable section is required to fill the sentinel.
         // Remember it here so that we don't have to find it again.
-        auto *Sentinel = cast<ARMExidxSentinelSection>(Sections.back());
         Sentinel->Highest = Sections[Sections.size() - 2]->getLinkOrderDep();
       }
 




More information about the llvm-commits mailing list