Skip to content

Commit

Permalink
Avoid some getSymbolNMTypeChar uses in COFFObjectFile.cpp itself.
Browse files Browse the repository at this point in the history
This is a fixed version of 193928 which keeps these uses in sync.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193931 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
espindola committed Nov 2, 2013
1 parent 7e56fc6 commit 1b6c8d1
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions lib/Object/COFFObjectFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,8 @@ error_code COFFObjectFile::getSymbolFileOffset(DataRefImpl Symb,
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;
Expand All @@ -130,10 +128,8 @@ error_code COFFObjectFile::getSymbolAddress(DataRefImpl Symb,
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;
Expand Down Expand Up @@ -197,10 +193,8 @@ error_code COFFObjectFile::getSymbolSize(DataRefImpl Symb,
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;
Expand Down

0 comments on commit 1b6c8d1

Please sign in to comment.