diff options
| author | George Rimar <grimar@accesssoftek.com> | 2018-11-22 11:40:08 +0000 |
|---|---|---|
| committer | George Rimar <grimar@accesssoftek.com> | 2018-11-22 11:40:08 +0000 |
| commit | 94a16cb6111c0e10681f2047e043ff19882473e0 (patch) | |
| tree | cd73a0871d3ab6f3dfa3028ab5a589b1e41d7a7e | |
| parent | d9f59f8c80a4118792bab25216ef75d33c8a4ee6 (diff) | |
| download | bcm5719-llvm-94a16cb6111c0e10681f2047e043ff19882473e0.tar.gz bcm5719-llvm-94a16cb6111c0e10681f2047e043ff19882473e0.zip | |
[ELF] - Make SymbolTable::addDefined return Defined.
Now it returns Symbol. This should be NFC that
avoids doing cast at the caller's sides.
Differential revision: https://reviews.llvm.org/D54627
llvm-svn: 347455
| -rw-r--r-- | lld/ELF/SymbolTable.cpp | 8 | ||||
| -rw-r--r-- | lld/ELF/SymbolTable.h | 6 | ||||
| -rw-r--r-- | lld/ELF/Writer.cpp | 11 |
3 files changed, 12 insertions, 13 deletions
diff --git a/lld/ELF/SymbolTable.cpp b/lld/ELF/SymbolTable.cpp index f99b2a32021..e372461ee3c 100644 --- a/lld/ELF/SymbolTable.cpp +++ b/lld/ELF/SymbolTable.cpp @@ -459,9 +459,9 @@ static void reportDuplicate(Symbol *Sym, InputFile *NewFile, error(Msg); } -Symbol *SymbolTable::addDefined(StringRef Name, uint8_t StOther, uint8_t Type, - uint64_t Value, uint64_t Size, uint8_t Binding, - SectionBase *Section, InputFile *File) { +Defined *SymbolTable::addDefined(StringRef Name, uint8_t StOther, uint8_t Type, + uint64_t Value, uint64_t Size, uint8_t Binding, + SectionBase *Section, InputFile *File) { Symbol *S; bool WasInserted; std::tie(S, WasInserted) = insert(Name, getVisibility(StOther), @@ -474,7 +474,7 @@ Symbol *SymbolTable::addDefined(StringRef Name, uint8_t StOther, uint8_t Type, else if (Cmp == 0) reportDuplicate(S, File, dyn_cast_or_null<InputSectionBase>(Section), Value); - return S; + return cast<Defined>(S); } template <typename ELFT> diff --git a/lld/ELF/SymbolTable.h b/lld/ELF/SymbolTable.h index e91e5cc2cef..b5fd8d3b4ed 100644 --- a/lld/ELF/SymbolTable.h +++ b/lld/ELF/SymbolTable.h @@ -45,9 +45,9 @@ public: Symbol *addUndefined(StringRef Name, uint8_t Binding, uint8_t StOther, uint8_t Type, bool CanOmitFromDynSym, InputFile *File); - Symbol *addDefined(StringRef Name, uint8_t StOther, uint8_t Type, - uint64_t Value, uint64_t Size, uint8_t Binding, - SectionBase *Section, InputFile *File); + Defined *addDefined(StringRef Name, uint8_t StOther, uint8_t Type, + uint64_t Value, uint64_t Size, uint8_t Binding, + SectionBase *Section, InputFile *File); template <class ELFT> void addShared(StringRef Name, SharedFile<ELFT> &F, diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index 0eb117a6228..98a464adf7f 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -172,15 +172,14 @@ static Defined *addOptionalRegular(StringRef Name, SectionBase *Sec, Symbol *S = Symtab->find(Name); if (!S || S->isDefined()) return nullptr; - Symbol *Sym = Symtab->addDefined(Name, StOther, STT_NOTYPE, Val, - /*Size=*/0, Binding, Sec, - /*File=*/nullptr); - return cast<Defined>(Sym); + return Symtab->addDefined(Name, StOther, STT_NOTYPE, Val, + /*Size=*/0, Binding, Sec, + /*File=*/nullptr); } static Defined *addAbsolute(StringRef Name) { - return cast<Defined>(Symtab->addDefined(Name, STV_HIDDEN, STT_NOTYPE, 0, 0, - STB_GLOBAL, nullptr, nullptr)); + return Symtab->addDefined(Name, STV_HIDDEN, STT_NOTYPE, 0, 0, STB_GLOBAL, + nullptr, nullptr); } // The linker is expected to define some symbols depending on |

