[lld] r299742 - Move a cast out of a function. NFC.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 6 18:40:21 PDT 2017


Author: rafael
Date: Thu Apr  6 20:40:21 2017
New Revision: 299742

URL: http://llvm.org/viewvc/llvm-project?rev=299742&view=rev
Log:
Move a cast out of a function. NFC.

The argument was always casted, so cast it in the caller.

Modified:
    lld/trunk/ELF/OutputSections.cpp
    lld/trunk/ELF/OutputSections.h

Modified: lld/trunk/ELF/OutputSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=299742&r1=299741&r2=299742&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.cpp (original)
+++ lld/trunk/ELF/OutputSections.cpp Thu Apr  6 20:40:21 2017
@@ -111,9 +111,8 @@ template <class ELFT> void OutputSection
   this->Info = S->OutSec->SectionIndex;
 }
 
-void OutputSection::addSection(InputSectionBase *C) {
-  assert(C->Live);
-  auto *S = cast<InputSection>(C);
+void OutputSection::addSection(InputSection *S) {
+  assert(S->Live);
   Sections.push_back(S);
   S->OutSec = this;
   this->updateAlignment(S->Alignment);
@@ -358,7 +357,7 @@ void OutputSectionFactory::addInputSec(I
     OutputSections.push_back(Sec);
   }
 
-  Sec->addSection(IS);
+  Sec->addSection(cast<InputSection>(IS));
 }
 
 OutputSectionFactory::~OutputSectionFactory() {}

Modified: lld/trunk/ELF/OutputSections.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.h?rev=299742&r1=299741&r2=299742&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.h (original)
+++ lld/trunk/ELF/OutputSections.h Thu Apr  6 20:40:21 2017
@@ -77,7 +77,7 @@ public:
   uint64_t Addr = 0;
   uint32_t ShName = 0;
 
-  void addSection(InputSectionBase *C);
+  void addSection(InputSection *S);
   void sort(std::function<int(InputSectionBase *S)> Order);
   void sortInitFini();
   void sortCtorsDtors();




More information about the llvm-commits mailing list