[lld] 81ed005 - [ELF] Remove EhFrameSection::addSection. NFC

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 31 19:55:08 PDT 2022


Author: Fangrui Song
Date: 2022-07-31T19:55:05-07:00
New Revision: 81ed005c4cf8e74d803a99c322eca0b681ff00f4

URL: https://github.com/llvm/llvm-project/commit/81ed005c4cf8e74d803a99c322eca0b681ff00f4
DIFF: https://github.com/llvm/llvm-project/commit/81ed005c4cf8e74d803a99c322eca0b681ff00f4.diff

LOG: [ELF] Remove EhFrameSection::addSection. NFC

Added: 
    

Modified: 
    lld/ELF/SyntheticSections.cpp
    lld/ELF/SyntheticSections.h

Removed: 
    


################################################################################
diff  --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp
index af424d6ceead..f21e60e44da4 100644
--- a/lld/ELF/SyntheticSections.cpp
+++ b/lld/ELF/SyntheticSections.cpp
@@ -431,16 +431,6 @@ void EhFrameSection::addSectionAux(EhInputSection *sec) {
     addRecords<ELFT>(sec, rels.relas);
 }
 
-void EhFrameSection::addSection(EhInputSection *sec) {
-  sec->parent = this;
-
-  alignment = std::max(alignment, sec->alignment);
-  sections.push_back(sec);
-
-  for (auto *ds : sec->dependentSections)
-    dependentSections.push_back(ds);
-}
-
 // Used by ICF<ELFT>::handleLSDA(). This function is very similar to
 // EhFrameSection::addRecords().
 template <class ELFT, class RelTy>
@@ -3345,8 +3335,13 @@ template <class ELFT> void elf::splitSections() {
 
 void elf::combineEhSections() {
   llvm::TimeTraceScope timeScope("Combine EH sections");
-  for (EhInputSection *sec : ehInputSections)
-    sec->getPartition().ehFrame->addSection(sec);
+  for (EhInputSection *sec : ehInputSections) {
+    EhFrameSection &eh = *sec->getPartition().ehFrame;
+    sec->parent = &eh;
+    eh.alignment = std::max(eh.alignment, sec->alignment);
+    eh.sections.push_back(sec);
+    llvm::append_range(eh.dependentSections, sec->dependentSections);
+  }
 
   if (!mainPart->armExidx)
     return;

diff  --git a/lld/ELF/SyntheticSections.h b/lld/ELF/SyntheticSections.h
index 120532245f63..5cbe7702fd81 100644
--- a/lld/ELF/SyntheticSections.h
+++ b/lld/ELF/SyntheticSections.h
@@ -52,8 +52,6 @@ class EhFrameSection final : public SyntheticSection {
     return SyntheticSection::classof(d) && d->name == ".eh_frame";
   }
 
-  void addSection(EhInputSection *sec);
-
   SmallVector<EhInputSection *, 0> sections;
   size_t numFdes = 0;
 


        


More information about the llvm-commits mailing list