[PATCH] D24492: [LTO] Switch to the new resolution-based API.
Rafael Ávila de Espíndola via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 28 09:49:20 PDT 2016
rafael added inline comments.
================
Comment at: lld/ELF/InputFiles.cpp:629
@@ -627,3 +628,3 @@
-static uint8_t getGvVisibility(const GlobalValue *GV) {
- switch (GV->getVisibility()) {
+static uint8_t mapVisibility(uint8_t GvVisibility) {
+ switch (GvVisibility) {
----------------
You can use GlobalValue::VisibilityTypes to make the argument type clear.
================
Comment at: lld/ELF/InputFiles.cpp:642
@@ -640,12 +641,3 @@
template <class ELFT>
-Symbol *BitcodeFile::createSymbol(const DenseSet<const Comdat *> &KeptComdats,
- const IRObjectFile &Obj,
- const BasicSymbolRef &Sym) {
- const GlobalValue *GV = Obj.getSymbolGV(Sym.getRawDataRefImpl());
-
- SmallString<64> Name;
- raw_svector_ostream OS(Name);
- Sym.printName(OS);
- StringRef NameRef = Saver.save(StringRef(Name));
-
- uint32_t Flags = Sym.getFlags();
+Symbol *createBitcodeSymbol(const DenseSet<const Comdat *> &KeptComdats,
+ const lto::InputFile &Obj,
----------------
static
================
Comment at: lld/ELF/InputFiles.cpp:644
@@ +643,3 @@
+ const lto::InputFile &Obj,
+ const llvm::lto::InputFile::Symbol &ObjSym,
+ llvm::StringSaver Saver, BitcodeFile *F) {
----------------
You don't need the llvm:: prefixes.
Do you really want a StringSaver by value?
================
Comment at: lld/ELF/InputFiles.cpp:655
@@ +654,3 @@
+ if (ObjSym.isTLS())
+ Type = STT_TLS;
+ Visibility = mapVisibility(ObjSym.getVisibility());
----------------
Simplify to just
uint8_t Type = ObjSym.isTLS() ? STT_TLS : STT_NOTYPE;
================
Comment at: lld/ELF/InputFiles.cpp:656
@@ +655,3 @@
+ Type = STT_TLS;
+ Visibility = mapVisibility(ObjSym.getVisibility());
+
----------------
Simplify to
uint8_t Visibility = mapVisibility(ObjSym.getVisibility());
================
Comment at: lld/ELF/InputFiles.cpp:661
@@ -679,1 +660,3 @@
+ return Symtab<ELFT>::X->addUndefined(NameRef, Binding, Visibility, Type,
+ CanOmitFromDynSym, false, F);
----------------
You have lost HasUnnamedAddr. Where do you compensate for that?
https://reviews.llvm.org/D24492
More information about the llvm-commits
mailing list