[lld] 565b3b0 - [ELF] Simplify InputSectionBase::getSize

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 20 16:02:43 PST 2022


Author: Fangrui Song
Date: 2022-11-21T00:02:36Z
New Revision: 565b3b01b11f1e76bb6f93fe0da02309354525b5

URL: https://github.com/llvm/llvm-project/commit/565b3b01b11f1e76bb6f93fe0da02309354525b5
DIFF: https://github.com/llvm/llvm-project/commit/565b3b01b11f1e76bb6f93fe0da02309354525b5.diff

LOG: [ELF] Simplify InputSectionBase::getSize

Added: 
    

Modified: 
    lld/ELF/InputSection.cpp

Removed: 
    


################################################################################
diff  --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp
index f08db5536254..5238639bc24f 100644
--- a/lld/ELF/InputSection.cpp
+++ b/lld/ELF/InputSection.cpp
@@ -103,9 +103,7 @@ InputSectionBase::InputSectionBase(ObjFile<ELFT> &file,
 size_t InputSectionBase::getSize() const {
   if (auto *s = dyn_cast<SyntheticSection>(this))
     return s->getSize();
-  if (compressed)
-    return size;
-  return content().size() - bytesDropped;
+  return size - bytesDropped;
 }
 
 template <class ELFT>


        


More information about the llvm-commits mailing list