[llvm] r193931 - Avoid some getSymbolNMTypeChar uses in COFFObjectFile.cpp itself.

Rafael Espindola rafael.espindola at gmail.com
Sat Nov 2 11:07:49 PDT 2013


Author: rafael
Date: Sat Nov  2 13:07:48 2013
New Revision: 193931

URL: http://llvm.org/viewvc/llvm-project?rev=193931&view=rev
Log:
Avoid some getSymbolNMTypeChar uses in COFFObjectFile.cpp itself.

This is a fixed version of 193928 which keeps these uses in sync.

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=193931&r1=193930&r2=193931&view=diff
==============================================================================
--- llvm/trunk/lib/Object/COFFObjectFile.cpp (original)
+++ llvm/trunk/lib/Object/COFFObjectFile.cpp Sat Nov  2 13:07:48 2013
@@ -112,10 +112,8 @@ error_code COFFObjectFile::getSymbolFile
   const coff_section *Section = NULL;
   if (error_code ec = getSection(symb->SectionNumber, Section))
     return ec;
-  char Type;
-  if (error_code ec = getSymbolNMTypeChar(Symb, Type))
-    return ec;
-  if (Type == 'U' || Type == 'w')
+
+  if (symb->SectionNumber == COFF::IMAGE_SYM_UNDEFINED)
     Result = UnknownAddressOrSize;
   else if (Section)
     Result = Section->PointerToRawData + symb->Value;
@@ -130,10 +128,8 @@ error_code COFFObjectFile::getSymbolAddr
   const coff_section *Section = NULL;
   if (error_code ec = getSection(symb->SectionNumber, Section))
     return ec;
-  char Type;
-  if (error_code ec = getSymbolNMTypeChar(Symb, Type))
-    return ec;
-  if (Type == 'U' || Type == 'w')
+
+  if (symb->SectionNumber == COFF::IMAGE_SYM_UNDEFINED)
     Result = UnknownAddressOrSize;
   else if (Section)
     Result = Section->VirtualAddress + symb->Value;
@@ -197,10 +193,8 @@ error_code COFFObjectFile::getSymbolSize
   const coff_section *Section = NULL;
   if (error_code ec = getSection(symb->SectionNumber, Section))
     return ec;
-  char Type;
-  if (error_code ec = getSymbolNMTypeChar(Symb, Type))
-    return ec;
-  if (Type == 'U' || Type == 'w')
+
+  if (symb->SectionNumber == COFF::IMAGE_SYM_UNDEFINED)
     Result = UnknownAddressOrSize;
   else if (Section)
     Result = Section->SizeOfRawData - symb->Value;





More information about the llvm-commits mailing list