[lld] r337265 - [ELF] - Simplify Symbol::getSize(). NFC.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 17 04:35:28 PDT 2018


Author: grimar
Date: Tue Jul 17 04:35:28 2018
New Revision: 337265

URL: http://llvm.org/viewvc/llvm-project?rev=337265&view=rev
Log:
[ELF] - Simplify Symbol::getSize(). NFC.

There are following symbols currently available:
DefinedKind, SharedKind, UndefinedKind, LazyArchiveKind, LazyObjectKind.

Our code calls getSize() only for first two and there
seems to be no reason to return 0 for the rest.


Modified:
    lld/trunk/ELF/Symbols.cpp

Modified: lld/trunk/ELF/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.cpp?rev=337265&r1=337264&r2=337265&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.cpp (original)
+++ lld/trunk/ELF/Symbols.cpp Tue Jul 17 04:35:28 2018
@@ -144,9 +144,7 @@ uint64_t Symbol::getPltOffset() const {
 uint64_t Symbol::getSize() const {
   if (const auto *DR = dyn_cast<Defined>(this))
     return DR->Size;
-  if (const auto *S = dyn_cast<SharedSymbol>(this))
-    return S->Size;
-  return 0;
+  return cast<SharedSymbol>(this)->Size;
 }
 
 OutputSection *Symbol::getOutputSection() const {




More information about the llvm-commits mailing list