Object/COFF: Change type from a struct to a uint16_t. The struct would be
authorMichael J. Spencer <bigcheesegs@gmail.com>
Tue, 18 Oct 2011 19:31:59 +0000 (19:31 +0000)
committerMichael J. Spencer <bigcheesegs@gmail.com>
Tue, 18 Oct 2011 19:31:59 +0000 (19:31 +0000)
incorrect for bigendian systems.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142403 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Object/COFF.h
lib/Object/COFFObjectFile.cpp

index db05c98aafa080f37ab01dfe6d0d647e02e35a9b..1f577c74339d7a21917ca59feb5f6f84e5114b2b 100644 (file)
@@ -45,13 +45,18 @@ struct coff_symbol {
   support::ulittle32_t Value;
   support::little16_t SectionNumber;
 
-  struct {
-    support::ulittle8_t BaseType;
-    support::ulittle8_t ComplexType;
-  } Type;
+  support::ulittle16_t Type;
 
   support::ulittle8_t  StorageClass;
   support::ulittle8_t  NumberOfAuxSymbols;
+
+  uint8_t getBaseType() const {
+    return Type & 0x0F;
+  }
+
+  uint8_t getComplexType() const {
+    return (Type & 0xF0) >> 4;
+  }
 };
 
 struct coff_section {
index 13356520d7b03398adbd2cc7c072357eb80afec0..e52a31f67f99304d3a7e596f35cdd4b5e696697c 100644 (file)
@@ -147,7 +147,7 @@ error_code COFFObjectFile::getSymbolType(DataRefImpl Symb,
       symb->SectionNumber == COFF::IMAGE_SYM_UNDEFINED) {
     Result = SymbolRef::ST_External;
   } else {
-    if (symb->Type.ComplexType == COFF::IMAGE_SYM_DTYPE_FUNCTION) {
+    if (symb->getComplexType() == COFF::IMAGE_SYM_DTYPE_FUNCTION) {
       Result = SymbolRef::ST_Function;
     } else {
       char Type;