[lld] r259238 - Replace code duplications with function calls.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 29 12:31:05 PST 2016


Author: ruiu
Date: Fri Jan 29 14:31:05 2016
New Revision: 259238

URL: http://llvm.org/viewvc/llvm-project?rev=259238&view=rev
Log:
Replace code duplications with function calls.

Modified:
    lld/trunk/ELF/OutputSections.cpp

Modified: lld/trunk/ELF/OutputSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=259238&r1=259237&r2=259238&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.cpp (original)
+++ lld/trunk/ELF/OutputSections.cpp Fri Jan 29 14:31:05 2016
@@ -826,8 +826,7 @@ void OutputSection<ELFT>::addSection(Inp
   Sections.push_back(S);
   S->OutSec = this;
   uint32_t Align = S->getAlign();
-  if (Align > this->Header.sh_addralign)
-    this->Header.sh_addralign = Align;
+  this->updateAlign(Align);
 
   uintX_t Off = this->Header.sh_size;
   Off = alignTo(Off, Align);
@@ -1098,10 +1097,7 @@ void EHOutputSection<ELFT>::addSectionAu
   const endianness E = ELFT::TargetEndianness;
 
   S->OutSec = this;
-  uint32_t Align = S->getAlign();
-  if (Align > this->Header.sh_addralign)
-    this->Header.sh_addralign = Align;
-
+  this->updateAlign(S->getAlign());
   Sections.push_back(S);
 
   ArrayRef<uint8_t> SecData = S->getSectionData();
@@ -1285,9 +1281,7 @@ template <class ELFT>
 void MergeOutputSection<ELFT>::addSection(InputSectionBase<ELFT> *C) {
   auto *S = cast<MergeInputSection<ELFT>>(C);
   S->OutSec = this;
-  uint32_t Align = S->getAlign();
-  if (Align > this->Header.sh_addralign)
-    this->Header.sh_addralign = Align;
+  this->updateAlign(S->getAlign());
 
   ArrayRef<uint8_t> D = S->getSectionData();
   StringRef Data((const char *)D.data(), D.size());




More information about the llvm-commits mailing list