[PATCH] D33548: [DWARF] - Cleanup relocation handling.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 26 08:44:04 PDT 2017
grimar added inline comments.
================
Comment at: include/llvm/Object/RelocVisitor.h:53
uint64_t visit(uint32_t RelocType, RelocationRef R, uint64_t Value = 0) {
- if (isa<ELFObjectFileBase>(ObjToVisit))
- return visitELF(RelocType, R, Value);
- if (isa<COFFObjectFile>(ObjToVisit))
- return visitCOFF(RelocType, R, Value);
- if (isa<MachOObjectFile>(ObjToVisit))
- return visitMachO(RelocType, R, Value);
-
- HasError = true;
- return 0;
+ return (this->*Vis)(RelocType, R, Value);
}
----------------
dblaikie wrote:
> Have you/could you try keeping the selection here, but using a switch over ObjToVisit.getType() rather than the if/else chain? (maybe that'll be easy enough to optimize & tidy things up rather than having to have the indirection through a function pointer.
Rui did a great cleenup here and it is looks much easier to avoid check of file type and target type on each relocation.
It just looks a bit wierd as obviously a useless job.
https://reviews.llvm.org/D33548
More information about the llvm-commits
mailing list