[ELF] - Simplify. NFCI.
authorGeorge Rimar <grimar@accesssoftek.com>
Wed, 11 Jul 2018 15:18:23 +0000 (15:18 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Wed, 11 Jul 2018 15:18:23 +0000 (15:18 +0000)
It does not look possible to end up with empty Sections
at this place. And this knowledge allows simplifying the code.

llvm-svn: 336814

lld/ELF/Writer.cpp

index 495c37f..2f58be5 100644 (file)
@@ -1425,13 +1425,12 @@ template <class ELFT> void Writer<ELFT>::resolveShfLinkOrder() {
     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();
       }