[PATCH] D31654: [LLD][ELF] Make createThunks a class [NFC]

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 4 16:58:22 PDT 2017


ruiu accepted this revision.
ruiu added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: ELF/Relocations.cpp:998
+  auto res = ThunkedSymbols.insert({&Body, nullptr});
+  if (res.second == true)
+    res.first->second = addThunk<ELFT>(Type, Body);
----------------
Remove `== true`.


================
Comment at: ELF/Relocations.cpp:1027
         SymbolBody &Body = *Rel.Sym;
         if (Target->needsThunk(Rel.Expr, Rel.Type, IS->File, Body)) {
           Thunk *T;
----------------
Flip the condition and do continue early.


================
Comment at: ELF/Relocations.h:121
+class Thunk;
+template <class ELFT> class ThunkCreator {
+public:
----------------
Please use more vertical space to layout code. I'd add a blank line here as this is the start of a class declaration. Also please add blank lines before comments.


================
Comment at: ELF/Relocations.h:132-137
+  // Track Symbols that already have a Thunk
+  llvm::DenseMap<SymbolBody *, Thunk *> ThunkedSymbols;
+  // Track InputSections that have a ThunkSection placed in front
+  llvm::DenseMap<InputSection *, ThunkSection *> ThunkedSections;
+  // Track the ThunksSections that need to be inserted into an OutputSection
+  std::map<OutputSection *, std::vector<ThunkSection *>> ThunkSections;
----------------
So break them into three blocks.


https://reviews.llvm.org/D31654





More information about the llvm-commits mailing list