[PATCH] D41204: Inline a small function.
Rui Ueyama via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 13 14:54:48 PST 2017
This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL320652: Inline a small function. (authored by ruiu, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D41204?vs=126842&id=126848#toc
Repository:
rL LLVM
https://reviews.llvm.org/D41204
Files:
lld/trunk/ELF/InputFiles.cpp
lld/trunk/ELF/InputFiles.h
Index: lld/trunk/ELF/InputFiles.h
===================================================================
--- lld/trunk/ELF/InputFiles.h
+++ lld/trunk/ELF/InputFiles.h
@@ -194,7 +194,6 @@
StringRef SourceFile;
private:
- InputSectionBase *getSection(uint32_t Index) const;
void
initializeSections(llvm::DenseSet<llvm::CachedHashStringRef> &ComdatGroups);
void initializeSymbols();
Index: lld/trunk/ELF/InputFiles.cpp
===================================================================
--- lld/trunk/ELF/InputFiles.cpp
+++ lld/trunk/ELF/InputFiles.cpp
@@ -599,19 +599,14 @@
this->Symbols.push_back(createSymbol(&Sym));
}
-template <class ELFT>
-InputSectionBase *ObjFile<ELFT>::getSection(uint32_t Index) const {
- if (Index == 0)
- return nullptr;
- if (Index >= this->Sections.size())
- fatal(toString(this) + ": invalid section index: " + Twine(Index));
- return this->Sections[Index];
-}
-
template <class ELFT> Symbol *ObjFile<ELFT>::createSymbol(const Elf_Sym *Sym) {
int Binding = Sym->getBinding();
- InputSectionBase *Sec = getSection(this->getSectionIndex(*Sym));
+ uint32_t SecIdx = this->getSectionIndex(*Sym);
+ if (SecIdx >= this->Sections.size())
+ fatal(toString(this) + ": invalid section index: " + Twine(SecIdx));
+
+ InputSectionBase *Sec = this->Sections[SecIdx];
uint8_t StOther = Sym->st_other;
uint8_t Type = Sym->getType();
uint64_t Value = Sym->st_value;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41204.126848.patch
Type: text/x-patch
Size: 1431 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171213/ff5c7ef4/attachment.bin>
More information about the llvm-commits
mailing list