[llvm] r240554 - Simplify the logic, NFC.

Rafael Espindola rafael.espindola at gmail.com
Wed Jun 24 10:08:44 PDT 2015


Author: rafael
Date: Wed Jun 24 12:08:44 2015
New Revision: 240554

URL: http://llvm.org/viewvc/llvm-project?rev=240554&view=rev
Log:
Simplify the logic, NFC.

Modified:
    llvm/trunk/lib/Object/COFFObjectFile.cpp

Modified: llvm/trunk/lib/Object/COFFObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/COFFObjectFile.cpp?rev=240554&r1=240553&r2=240554&view=diff
==============================================================================
--- llvm/trunk/lib/Object/COFFObjectFile.cpp (original)
+++ llvm/trunk/lib/Object/COFFObjectFile.cpp Wed Jun 24 12:08:44 2015
@@ -154,25 +154,21 @@ std::error_code COFFObjectFile::getSymbo
                                                  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();
 }
 





More information about the llvm-commits mailing list