Fix pr24832.
[oota-llvm.git] / include / llvm / MC / MCSectionMachO.h
index 444a84836b6e603a9160dba8d0c4fcd8393eabce..658dfcda7268814e989f7f8091bfa8f3046fbd3d 100644 (file)
 
 namespace llvm {
 
-/// MCSectionMachO - This represents a section on a Mach-O system (used by
-/// Mac OS X).  On a Mac system, these are also described in
-/// /usr/include/mach-o/loader.h.
-class MCSectionMachO : public MCSection {
+/// This represents a section on a Mach-O system (used by Mac OS X).  On a Mac
+/// system, these are also described in /usr/include/mach-o/loader.h.
+class MCSectionMachO final : public MCSection {
   char SegmentName[16];  // Not necessarily null terminated!
   char SectionName[16];  // Not necessarily null terminated!
 
-  /// TypeAndAttributes - This is the SECTION_TYPE and SECTION_ATTRIBUTES
-  /// field of a section, drawn from the enums below.
+  /// This is the SECTION_TYPE and SECTION_ATTRIBUTES field of a section, drawn
+  /// from the enums below.
   unsigned TypeAndAttributes;
 
-  /// Reserved2 - The 'reserved2' field of a section, used to represent the
-  /// size of stubs, for example.
+  /// The 'reserved2' field of a section, used to represent the size of stubs,
+  /// for example.
   unsigned Reserved2;
 
-  MCSectionMachO(StringRef Segment, StringRef Section,
-                 unsigned TAA, unsigned reserved2, SectionKind K);
+  MCSectionMachO(StringRef Segment, StringRef Section, unsigned TAA,
+                 unsigned reserved2, SectionKind K, MCSymbol *Begin);
   friend class MCContext;
 public:
 
@@ -53,28 +52,23 @@ public:
     return StringRef(SectionName);
   }
 
-  std::string getLabelBeginName() const override {
-    return StringRef(getSegmentName().str() + getSectionName().str() + "_begin");
-  }
-
-  std::string getLabelEndName() const override {
-    return StringRef(getSegmentName().str() + getSectionName().str() + "_end");
-  }
-
   unsigned getTypeAndAttributes() const { return TypeAndAttributes; }
   unsigned getStubSize() const { return Reserved2; }
 
-  unsigned getType() const { return TypeAndAttributes & MachO::SECTION_TYPE; }
+  MachO::SectionType getType() const {
+    return static_cast<MachO::SectionType>(TypeAndAttributes &
+                                           MachO::SECTION_TYPE);
+  }
   bool hasAttribute(unsigned Value) const {
     return (TypeAndAttributes & Value) != 0;
   }
 
-  /// 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
-  /// parameters and returns an empty string.  When an invalid section
-  /// specifier is present, this returns a string indicating the problem.
-  /// If no TAA was parsed, TAA is not altered, and TAAWasSet becomes false.
+  /// 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 parameters and returns an
+  /// empty string.  When an invalid section specifier is present, this returns
+  /// a string indicating the problem. If no TAA was parsed, TAA is not altered,
+  /// and TAAWasSet becomes false.
   static std::string ParseSectionSpecifier(StringRef Spec,       // In.
                                            StringRef &Segment,   // Out.
                                            StringRef &Section,   // Out.