[PATCH] D33548: [DWARF] - Cleanup relocation handling.
David Blaikie via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 25 10:47:50 PDT 2017
dblaikie 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);
}
----------------
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.
https://reviews.llvm.org/D33548
More information about the llvm-commits
mailing list