[lld] 385573e - [ELF] Inline ARMExidxSyntheticSection::classof. NFC

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 15 23:41:36 PDT 2022


Author: Fangrui Song
Date: 2022-03-15T23:41:30-07:00
New Revision: 385573e07b528f04e70aeb82c3462cb0bd699779

URL: https://github.com/llvm/llvm-project/commit/385573e07b528f04e70aeb82c3462cb0bd699779
DIFF: https://github.com/llvm/llvm-project/commit/385573e07b528f04e70aeb82c3462cb0bd699779.diff

LOG: [ELF] Inline ARMExidxSyntheticSection::classof. NFC

To optimize the only call site `dyn_cast<ARMExidxSyntheticSection>(first)` and
decrease code size.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp
index 7b8de80f156d8..aa6ed9265ec6b 100644
--- a/lld/ELF/SyntheticSections.cpp
+++ b/lld/ELF/SyntheticSections.cpp
@@ -3571,10 +3571,6 @@ bool ARMExidxSyntheticSection::isNeeded() const {
                       [](InputSection *isec) { return isec->isLive(); });
 }
 
-bool ARMExidxSyntheticSection::classof(const SectionBase *d) {
-  return d->kind() == InputSectionBase::Synthetic && d->type == SHT_ARM_EXIDX;
-}
-
 ThunkSection::ThunkSection(OutputSection *os, uint64_t off)
     : SyntheticSection(SHF_ALLOC | SHF_EXECINSTR, SHT_PROGBITS,
                        config->emachine == EM_PPC64 ? 16 : 4, ".text.thunk") {

diff  --git a/lld/ELF/SyntheticSections.h b/lld/ELF/SyntheticSections.h
index 0248cd0d1b236..f0f0c4845e6f6 100644
--- a/lld/ELF/SyntheticSections.h
+++ b/lld/ELF/SyntheticSections.h
@@ -1082,7 +1082,10 @@ class ARMExidxSyntheticSection : public SyntheticSection {
   void finalizeContents() override;
   InputSection *getLinkOrderDep() const;
 
-  static bool classof(const SectionBase *d);
+  static bool classof(const SectionBase *sec) {
+    return sec->kind() == InputSectionBase::Synthetic &&
+           sec->type == llvm::ELF::SHT_ARM_EXIDX;
+  }
 
   // Links to the ARMExidxSections so we can transfer the relocations once the
   // layout is known.


        


More information about the llvm-commits mailing list