[lld] r285238 - Make the DefinedRegular constructors more regular. NFC.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 26 13:35:00 PDT 2016
Author: rafael
Date: Wed Oct 26 15:34:59 2016
New Revision: 285238
URL: http://llvm.org/viewvc/llvm-project?rev=285238&view=rev
Log:
Make the DefinedRegular constructors more regular. NFC.
All the global ones now just forward to the same constructor. This
makes it easier to construct them without creating a Elf_Sym.
Modified:
lld/trunk/ELF/Symbols.h
Modified: lld/trunk/ELF/Symbols.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.h?rev=285238&r1=285237&r2=285238&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.h (original)
+++ lld/trunk/ELF/Symbols.h Wed Oct 26 15:34:59 2016
@@ -186,16 +186,31 @@ template <class ELFT> class DefinedRegul
typedef typename ELFT::uint uintX_t;
public:
- DefinedRegular(StringRef Name, const Elf_Sym &Sym,
- InputSectionBase<ELFT> *Section)
- : Defined(SymbolBody::DefinedRegularKind, Name, Sym.st_other,
- Sym.getType()),
- Value(Sym.st_value), Size(Sym.st_size),
+ DefinedRegular(StringRef Name, uint8_t StOther, uint8_t Type, uintX_t Value,
+ uintX_t Size, InputSectionBase<ELFT> *Section, InputFile *File)
+ : Defined(SymbolBody::DefinedRegularKind, Name, StOther, Type),
+ Value(Value), Size(Size),
Section(Section ? Section->Repl : NullInputSection) {
- if (Section)
- this->File = Section->getFile();
+ this->File = File;
}
+ DefinedRegular(StringRef Name, uint8_t StOther, uint8_t Type, uintX_t Value,
+ uintX_t Size, InputSectionBase<ELFT> *Section)
+ : DefinedRegular(Name, StOther, Type, Value, Size, Section,
+ Section ? Section->getFile() : nullptr) {}
+
+ DefinedRegular(StringRef Name, const Elf_Sym &Sym,
+ InputSectionBase<ELFT> *Section)
+ : DefinedRegular(Name, Sym.st_other, Sym.getType(), Sym.st_value,
+ Sym.st_size, Section) {}
+
+ DefinedRegular(StringRef Name, uint8_t StOther)
+ : DefinedRegular(Name, StOther, llvm::ELF::STT_NOTYPE, 0, 0,
+ NullInputSection) {}
+
+ DefinedRegular(StringRef Name, uint8_t StOther, uint8_t Type, BitcodeFile *F)
+ : DefinedRegular(Name, StOther, Type, 0, 0, NullInputSection, F) {}
+
DefinedRegular(const Elf_Sym &Sym, InputSectionBase<ELFT> *Section)
: Defined(SymbolBody::DefinedRegularKind, Sym.st_name, Sym.st_other,
Sym.getType()),
@@ -206,17 +221,6 @@ public:
this->File = Section->getFile();
}
- DefinedRegular(StringRef Name, uint8_t StOther)
- : Defined(SymbolBody::DefinedRegularKind, Name, StOther,
- llvm::ELF::STT_NOTYPE),
- Value(0), Size(0), Section(NullInputSection) {}
-
- DefinedRegular(StringRef Name, uint8_t StOther, uint8_t Type, BitcodeFile *F)
- : Defined(SymbolBody::DefinedRegularKind, Name, StOther, Type), Value(0),
- Size(0), Section(NullInputSection) {
- this->File = F;
- }
-
// Return true if the symbol is a PIC function.
bool isMipsPIC() const;
More information about the llvm-commits
mailing list