[lld] r316811 - Inline trivial symbol constructors.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 27 16:26:46 PDT 2017
Author: ruiu
Date: Fri Oct 27 16:26:46 2017
New Revision: 316811
URL: http://llvm.org/viewvc/llvm-project?rev=316811&view=rev
Log:
Inline trivial symbol constructors.
Modified:
lld/trunk/ELF/Symbols.cpp
lld/trunk/ELF/Symbols.h
Modified: lld/trunk/ELF/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.cpp?rev=316811&r1=316810&r2=316811&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.cpp (original)
+++ lld/trunk/ELF/Symbols.cpp Fri Oct 27 16:26:46 2017
@@ -119,13 +119,6 @@ static uint64_t getSymVA(const SymbolBod
llvm_unreachable("invalid symbol kind");
}
-SymbolBody::SymbolBody(Kind K, StringRefZ Name, bool IsLocal, uint8_t StOther,
- uint8_t Type)
- : SymbolKind(K), IsLocal(IsLocal), NeedsPltAddr(false),
- IsInGlobalMipsGot(false), Is32BitMipsGot(false), IsInIplt(false),
- IsInIgot(false), IsPreemptible(false), Type(Type), StOther(StOther),
- Name(Name) {}
-
// Returns true if this is a weak undefined symbol.
bool SymbolBody::isUndefWeak() const {
// See comment on Lazy in Symbols.h for the details.
@@ -257,10 +250,6 @@ void SymbolBody::parseSymbolVersion() {
Verstr);
}
-Defined::Defined(Kind K, StringRefZ Name, bool IsLocal, uint8_t StOther,
- uint8_t Type)
- : SymbolBody(K, Name, IsLocal, StOther, Type) {}
-
template <class ELFT> bool DefinedRegular::isMipsPIC() const {
typedef typename ELFT::Ehdr Elf_Ehdr;
if (!Section || !isFunc())
@@ -272,16 +261,6 @@ template <class ELFT> bool DefinedRegula
(Hdr->e_flags & EF_MIPS_PIC);
}
-Undefined::Undefined(StringRefZ Name, bool IsLocal, uint8_t StOther,
- uint8_t Type)
- : SymbolBody(SymbolBody::UndefinedKind, Name, IsLocal, StOther, Type) {}
-
-DefinedCommon::DefinedCommon(StringRef Name, uint64_t Size, uint32_t Alignment,
- uint8_t StOther, uint8_t Type)
- : Defined(SymbolBody::DefinedCommonKind, Name, /*IsLocal=*/false, StOther,
- Type),
- Alignment(Alignment), Size(Size) {}
-
// If a shared symbol is referred via a copy relocation, its alignment
// becomes part of the ABI. This function returns a symbol alignment.
// Because symbols don't have alignment attributes, we need to infer that.
@@ -299,12 +278,6 @@ InputFile *Lazy::fetch() {
return cast<LazyObject>(this)->fetch();
}
-LazyArchive::LazyArchive(const llvm::object::Archive::Symbol S, uint8_t Type)
- : Lazy(LazyArchiveKind, S.getName(), Type), Sym(S) {}
-
-LazyObject::LazyObject(StringRef Name, uint8_t Type)
- : Lazy(LazyObjectKind, Name, Type) {}
-
ArchiveFile *LazyArchive::getFile() {
return cast<ArchiveFile>(SymbolBody::getFile());
}
Modified: lld/trunk/ELF/Symbols.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.h?rev=316811&r1=316810&r2=316811&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.h (original)
+++ lld/trunk/ELF/Symbols.h Fri Oct 27 16:26:46 2017
@@ -104,7 +104,11 @@ public:
protected:
SymbolBody(Kind K, StringRefZ Name, bool IsLocal, uint8_t StOther,
- uint8_t Type);
+ uint8_t Type)
+ : SymbolKind(K), IsLocal(IsLocal), NeedsPltAddr(false),
+ IsInGlobalMipsGot(false), Is32BitMipsGot(false), IsInIplt(false),
+ IsInIgot(false), IsPreemptible(false), Type(Type), StOther(StOther),
+ Name(Name) {}
const unsigned SymbolKind : 8;
@@ -154,14 +158,19 @@ protected:
// The base class for any defined symbols.
class Defined : public SymbolBody {
public:
- Defined(Kind K, StringRefZ Name, bool IsLocal, uint8_t StOther, uint8_t Type);
+ Defined(Kind K, StringRefZ Name, bool IsLocal, uint8_t StOther, uint8_t Type)
+ : SymbolBody(K, Name, IsLocal, StOther, Type) {}
+
static bool classof(const SymbolBody *S) { return S->isDefined(); }
};
class DefinedCommon : public Defined {
public:
- DefinedCommon(StringRef N, uint64_t Size, uint32_t Alignment, uint8_t StOther,
- uint8_t Type);
+ DefinedCommon(StringRef Name, uint64_t Size, uint32_t Alignment,
+ uint8_t StOther, uint8_t Type)
+ : Defined(SymbolBody::DefinedCommonKind, Name, /*IsLocal=*/false, StOther,
+ Type),
+ Alignment(Alignment), Size(Size) {}
static bool classof(const SymbolBody *S) {
return S->kind() == SymbolBody::DefinedCommonKind;
@@ -198,7 +207,8 @@ public:
class Undefined : public SymbolBody {
public:
- Undefined(StringRefZ Name, bool IsLocal, uint8_t StOther, uint8_t Type);
+ Undefined(StringRefZ Name, bool IsLocal, uint8_t StOther, uint8_t Type)
+ : SymbolBody(SymbolBody::UndefinedKind, Name, IsLocal, StOther, Type) {}
static bool classof(const SymbolBody *S) {
return S->kind() == UndefinedKind;
@@ -295,7 +305,8 @@ protected:
// symbol.
class LazyArchive : public Lazy {
public:
- LazyArchive(const llvm::object::Archive::Symbol S, uint8_t Type);
+ LazyArchive(const llvm::object::Archive::Symbol S, uint8_t Type)
+ : Lazy(LazyArchiveKind, S.getName(), Type), Sym(S) {}
static bool classof(const SymbolBody *S) {
return S->kind() == LazyArchiveKind;
@@ -312,7 +323,7 @@ private:
// --start-lib and --end-lib options.
class LazyObject : public Lazy {
public:
- LazyObject(StringRef Name, uint8_t Type);
+ LazyObject(StringRef Name, uint8_t Type) : Lazy(LazyObjectKind, Name, Type) {}
static bool classof(const SymbolBody *S) {
return S->kind() == LazyObjectKind;
More information about the llvm-commits
mailing list