MCStreamer.h: Prune \return, corresponding to r252102. [-Wdocumentation]
[oota-llvm.git] / include / llvm / MC / MCSection.h
index 5ca83398bd0dff71eacb8ca475386dc527b15924..c049ad5455bf31268b35209cb18d4d857e21e26b 100644 (file)
@@ -18,6 +18,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/ilist.h"
 #include "llvm/ADT/ilist_node.h"
+#include "llvm/MC/MCAssembler.h"
 #include "llvm/MC/SectionKind.h"
 #include "llvm/Support/Compiler.h"
 
@@ -31,76 +32,16 @@ class MCSection;
 class MCSymbol;
 class raw_ostream;
 
-class MCSectionData {
-  friend class MCAsmLayout;
+template<>
+struct ilist_node_traits<MCFragment> {
+  MCFragment *createNode(const MCFragment &V);
+  static void deleteNode(MCFragment *V);
 
-  MCSectionData(const MCSectionData &) = delete;
-  void operator=(const MCSectionData &) = delete;
-
-public:
-  typedef iplist<MCFragment> FragmentListType;
-
-  typedef FragmentListType::const_iterator const_iterator;
-  typedef FragmentListType::iterator iterator;
-
-  typedef FragmentListType::const_reverse_iterator const_reverse_iterator;
-  typedef FragmentListType::reverse_iterator reverse_iterator;
-
-private:
-  FragmentListType Fragments;
-  MCSection *Section;
-
-  /// \name Assembler Backend Data
-  /// @{
-  //
-  // FIXME: This could all be kept private to the assembler implementation.
-
-  /// Mapping from subsection number to insertion point for subsection numbers
-  /// below that number.
-  SmallVector<std::pair<unsigned, MCFragment *>, 1> SubsectionFragmentMap;
-
-  /// @}
-
-public:
-  explicit MCSectionData(MCSection &Section);
-
-  MCSection &getSection() const { return *Section; }
-
-  /// \name Fragment Access
-  /// @{
-
-  const FragmentListType &getFragmentList() const { return Fragments; }
-  FragmentListType &getFragmentList() { return Fragments; }
-
-  iterator begin();
-  const_iterator begin() const {
-    return const_cast<MCSectionData *>(this)->begin();
-  }
-
-  iterator end();
-  const_iterator end() const {
-    return const_cast<MCSectionData *>(this)->end();
-  }
-
-  reverse_iterator rbegin();
-  const_reverse_iterator rbegin() const {
-    return const_cast<MCSectionData *>(this)->rbegin();
-  }
-
-  reverse_iterator rend();
-  const_reverse_iterator rend() const {
-    return const_cast<MCSectionData *>(this)->rend();
-  }
-
-  size_t size() const;
-
-  bool empty() const;
-
-  iterator getSubsectionInsertionPoint(unsigned Subsection);
-
-  void dump();
-
-  /// @}
+  void addNodeToList(MCFragment *) {}
+  void removeNodeFromList(MCFragment *) {}
+  void transferNodesFromList(ilist_node_traits &    /*SrcTraits*/,
+                             ilist_iterator<MCFragment> /*first*/,
+                             ilist_iterator<MCFragment> /*last*/) {}
 };
 
 /// Instances of this class represent a uniqued identifier for a section in the
@@ -116,6 +57,14 @@ public:
     BundleLockedAlignToEnd
   };
 
+  typedef iplist<MCFragment> FragmentListType;
+
+  typedef FragmentListType::const_iterator const_iterator;
+  typedef FragmentListType::iterator iterator;
+
+  typedef FragmentListType::const_reverse_iterator const_reverse_iterator;
+  typedef FragmentListType::reverse_iterator reverse_iterator;
+
 private:
   MCSection(const MCSection &) = delete;
   void operator=(const MCSection &) = delete;
@@ -137,21 +86,28 @@ private:
 
   /// \brief We've seen a bundle_lock directive but not its first instruction
   /// yet.
-  bool BundleGroupBeforeFirstInst = false;
+  unsigned BundleGroupBeforeFirstInst : 1;
 
   /// Whether this section has had instructions emitted into it.
   unsigned HasInstructions : 1;
 
-  MCSectionData Data;
+  unsigned IsRegistered : 1;
+
+  MCDummyFragment DummyFragment;
+
+  FragmentListType Fragments;
+
+  /// Mapping from subsection number to insertion point for subsection numbers
+  /// below that number.
+  SmallVector<std::pair<unsigned, MCFragment *>, 1> SubsectionFragmentMap;
 
 protected:
   MCSection(SectionVariant V, SectionKind K, MCSymbol *Begin);
   SectionVariant Variant;
   SectionKind Kind;
+  ~MCSection();
 
 public:
-  virtual ~MCSection();
-
   SectionKind getKind() const { return Kind; }
 
   SectionVariant getVariant() const { return Variant; }
@@ -190,31 +146,41 @@ public:
   bool hasInstructions() const { return HasInstructions; }
   void setHasInstructions(bool Value) { HasInstructions = Value; }
 
-  MCSectionData &getSectionData() { return Data; }
-  const MCSectionData &getSectionData() const {
-    return const_cast<MCSection *>(this)->getSectionData();
-  }
+  bool isRegistered() const { return IsRegistered; }
+  void setIsRegistered(bool Value) { IsRegistered = Value; }
 
-  MCSectionData::FragmentListType &getFragmentList();
-  const MCSectionData::FragmentListType &getFragmentList() const {
+  MCSection::FragmentListType &getFragmentList() { return Fragments; }
+  const MCSection::FragmentListType &getFragmentList() const {
     return const_cast<MCSection *>(this)->getFragmentList();
   }
 
-  MCSectionData::iterator begin();
-  MCSectionData::const_iterator begin() const {
+  const MCDummyFragment &getDummyFragment() const { return DummyFragment; }
+  MCDummyFragment &getDummyFragment() { return DummyFragment; }
+
+  MCSection::iterator begin();
+  MCSection::const_iterator begin() const {
     return const_cast<MCSection *>(this)->begin();
   }
 
-  MCSectionData::iterator end();
-  MCSectionData::const_iterator end() const {
+  MCSection::iterator end();
+  MCSection::const_iterator end() const {
     return const_cast<MCSection *>(this)->end();
   }
 
-  MCSectionData::reverse_iterator rend();
-  MCSectionData::const_reverse_iterator rend() const {
+  MCSection::reverse_iterator rbegin();
+  MCSection::const_reverse_iterator rbegin() const {
+    return const_cast<MCSection *>(this)->rbegin();
+  }
+
+  MCSection::reverse_iterator rend();
+  MCSection::const_reverse_iterator rend() const {
     return const_cast<MCSection *>(this)->rend();
   }
 
+  MCSection::iterator getSubsectionInsertionPoint(unsigned Subsection);
+
+  void dump();
+
   virtual void PrintSwitchToSection(const MCAsmInfo &MAI, raw_ostream &OS,
                                     const MCExpr *Subsection) const = 0;