summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object/SymbolSize.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-06-24 10:20:30 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-06-24 10:20:30 +0000
commitd7a32ea4b86c04ba0c4736f803527eb393a40867 (patch)
tree1b09dcd2e51416a33c0b030346842e8ea6dd3e38 /llvm/lib/Object/SymbolSize.cpp
parent595348228569c587e14bf8cea1c4fdf1b503c104 (diff)
downloadbcm5719-llvm-d7a32ea4b86c04ba0c4736f803527eb393a40867.tar.gz
bcm5719-llvm-d7a32ea4b86c04ba0c4736f803527eb393a40867.zip
Change how symbol sizes are handled in lib/Object.
COFF and MachO only define symbol sizes for common symbols. Reflect that in the class hierarchy by having a method for common symbols only in the base and a general one in ELF. This avoids the need of using a magic value for the size, which had a few problems * Most callers didn't check for it. * The ones that did could not tell the magic value from a file actually having that value. llvm-svn: 240529
Diffstat (limited to 'llvm/lib/Object/SymbolSize.cpp')
-rw-r--r--llvm/lib/Object/SymbolSize.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/llvm/lib/Object/SymbolSize.cpp b/llvm/lib/Object/SymbolSize.cpp
index 121bf1baa7a..925a3d4df46 100644
--- a/llvm/lib/Object/SymbolSize.cpp
+++ b/llvm/lib/Object/SymbolSize.cpp
@@ -41,10 +41,9 @@ ErrorOr<std::vector<std::pair<SymbolRef, uint64_t>>>
llvm::object::computeSymbolSizes(const ObjectFile &O) {
std::vector<std::pair<SymbolRef, uint64_t>> Ret;
- if (isa<ELFObjectFileBase>(&O)) {
- for (SymbolRef Sym : O.symbols()) {
- Ret.push_back({Sym, Sym.getSize()});
- }
+ if (const auto *E = dyn_cast<ELFObjectFileBase>(&O)) {
+ for (SymbolRef Sym : E->symbols())
+ Ret.push_back({Sym, E->getSymbolSize(Sym)});
return Ret;
}
OpenPOWER on IntegriCloud