summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object/COFFObjectFile.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-06-24 17:08:44 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-06-24 17:08:44 +0000
commit54c9f3da03151c9b0efd1e2d1ead071bfa45a91a (patch)
tree15e0d13eeeac4dea2070f955b9ac84d1d3496991 /llvm/lib/Object/COFFObjectFile.cpp
parentcc0a73c5eba4414b9a5e9f09b77c3eaa8077c67e (diff)
downloadbcm5719-llvm-54c9f3da03151c9b0efd1e2d1ead071bfa45a91a.tar.gz
bcm5719-llvm-54c9f3da03151c9b0efd1e2d1ead071bfa45a91a.zip
Simplify the logic, NFC.
llvm-svn: 240554
Diffstat (limited to 'llvm/lib/Object/COFFObjectFile.cpp')
-rw-r--r--llvm/lib/Object/COFFObjectFile.cpp20
1 files changed, 8 insertions, 12 deletions
diff --git a/llvm/lib/Object/COFFObjectFile.cpp b/llvm/lib/Object/COFFObjectFile.cpp
index 0595d38f086..c497b13ac01 100644
--- a/llvm/lib/Object/COFFObjectFile.cpp
+++ b/llvm/lib/Object/COFFObjectFile.cpp
@@ -154,25 +154,21 @@ std::error_code COFFObjectFile::getSymbolAddress(DataRefImpl Ref,
uint64_t &Result) const {
COFFSymbolRef Symb = getCOFFSymbol(Ref);
- if (Symb.isAnyUndefined()) {
+ if (Symb.isAnyUndefined() || Symb.isCommon()) {
Result = UnknownAddress;
return std::error_code();
}
- if (Symb.isCommon()) {
- Result = UnknownAddress;
- return std::error_code();
- }
- int32_t SectionNumber = Symb.getSectionNumber();
- if (!COFF::isReservedSectionNumber(SectionNumber)) {
- const coff_section *Section = nullptr;
- if (std::error_code EC = getSection(SectionNumber, Section))
- return EC;
- Result = Section->VirtualAddress + Symb.getValue();
+ int32_t SectionNumber = Symb.getSectionNumber();
+ if (COFF::isReservedSectionNumber(SectionNumber)) {
+ Result = Symb.getValue();
return std::error_code();
}
- Result = Symb.getValue();
+ const coff_section *Section = nullptr;
+ if (std::error_code EC = getSection(SectionNumber, Section))
+ return EC;
+ Result = Section->VirtualAddress + Symb.getValue();
return std::error_code();
}
OpenPOWER on IntegriCloud