[llvm-commits] [llvm] r98582 - in /llvm/trunk: include/llvm/MC/MCSectionMachO.h lib/MC/MCAssembler.cpp

Daniel Dunbar daniel at zuster.org
Mon Mar 15 14:56:38 PDT 2010


Author: ddunbar
Date: Mon Mar 15 16:56:38 2010
New Revision: 98582

URL: http://llvm.org/viewvc/llvm-project?rev=98582&view=rev
Log:
MC/Mach-O: Add MCSectionMachO::getType()

Modified:
    llvm/trunk/include/llvm/MC/MCSectionMachO.h
    llvm/trunk/lib/MC/MCAssembler.cpp

Modified: llvm/trunk/include/llvm/MC/MCSectionMachO.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSectionMachO.h?rev=98582&r1=98581&r2=98582&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCSectionMachO.h (original)
+++ llvm/trunk/include/llvm/MC/MCSectionMachO.h Mon Mar 15 16:56:38 2010
@@ -151,10 +151,12 @@
       return StringRef(SectionName, 16);
     return StringRef(SectionName);
   }
-  
+
   unsigned getTypeAndAttributes() const { return TypeAndAttributes; }
   unsigned getStubSize() const { return Reserved2; }
-  
+
+  unsigned getType() const { return TypeAndAttributes & SECTION_TYPE; }
+
   /// ParseSectionSpecifier - Parse the section specifier indicated by "Spec".
   /// This is a string that can appear after a .section directive in a mach-o
   /// flavored .s file.  If successful, this fills in the specified Out
@@ -165,7 +167,7 @@
                                            StringRef &Section,   // Out.
                                            unsigned  &TAA,       // Out.
                                            unsigned  &StubSize); // Out.
-  
+
   virtual void PrintSwitchToSection(const MCAsmInfo &MAI,
                                     raw_ostream &OS) const;
 };

Modified: llvm/trunk/lib/MC/MCAssembler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAssembler.cpp?rev=98582&r1=98581&r2=98582&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCAssembler.cpp (original)
+++ llvm/trunk/lib/MC/MCAssembler.cpp Mon Mar 15 16:56:38 2010
@@ -52,8 +52,7 @@
 static bool isVirtualSection(const MCSection &Section) {
   // FIXME: Lame.
   const MCSectionMachO &SMO = static_cast<const MCSectionMachO&>(Section);
-  unsigned Type = SMO.getTypeAndAttributes() & MCSectionMachO::SECTION_TYPE;
-  return (Type == MCSectionMachO::S_ZEROFILL);
+  return (SMO.getType() == MCSectionMachO::S_ZEROFILL);
 }
 
 static unsigned getFixupKindLog2Size(unsigned Kind) {
@@ -615,9 +614,7 @@
       const MCSectionMachO &Section =
         static_cast<const MCSectionMachO&>(it->SectionData->getSection());
 
-      unsigned Type =
-        Section.getTypeAndAttributes() & MCSectionMachO::SECTION_TYPE;
-      if (Type != MCSectionMachO::S_NON_LAZY_SYMBOL_POINTERS)
+      if (Section.getType() != MCSectionMachO::S_NON_LAZY_SYMBOL_POINTERS)
         continue;
 
       Asm.getOrCreateSymbolData(*it->Symbol);
@@ -630,10 +627,8 @@
       const MCSectionMachO &Section =
         static_cast<const MCSectionMachO&>(it->SectionData->getSection());
 
-      unsigned Type =
-        Section.getTypeAndAttributes() & MCSectionMachO::SECTION_TYPE;
-      if (Type != MCSectionMachO::S_LAZY_SYMBOL_POINTERS &&
-          Type != MCSectionMachO::S_SYMBOL_STUBS)
+      if (Section.getType() != MCSectionMachO::S_LAZY_SYMBOL_POINTERS &&
+          Section.getType() != MCSectionMachO::S_SYMBOL_STUBS)
         continue;
 
       // Set the symbol type to undefined lazy, but only on construction.
@@ -911,9 +906,7 @@
         // special handling.
         const MCSectionMachO &Section =
           static_cast<const MCSectionMachO&>(it->SectionData->getSection());
-        unsigned Type =
-          Section.getTypeAndAttributes() & MCSectionMachO::SECTION_TYPE;
-        if (Type == MCSectionMachO::S_NON_LAZY_SYMBOL_POINTERS) {
+        if (Section.getType() == MCSectionMachO::S_NON_LAZY_SYMBOL_POINTERS) {
           // If this symbol is defined and internal, mark it as such.
           if (it->Symbol->isDefined() &&
               !Asm.getSymbolData(*it->Symbol).isExternal()) {





More information about the llvm-commits mailing list