From 9a5f962059b7f09f9cc037d13eb099524112d181 Mon Sep 17 00:00:00 2001
From: Rafael Espindola <rafael.espindola@gmail.com>
Date: Wed, 24 Jun 2015 17:08:44 +0000
Subject: [PATCH] Simplify the logic, NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240554 91177308-0d34-0410-b5e6-96231b3b80d8
---
 lib/Object/COFFObjectFile.cpp | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/lib/Object/COFFObjectFile.cpp b/lib/Object/COFFObjectFile.cpp
index 0595d38f086..c497b13ac01 100644
--- a/lib/Object/COFFObjectFile.cpp
+++ b/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();
 }
 
-- 
2.34.1