llvm-mc/Mach-O: Unique sections properly, so we don't get duplicate text
sections, etc.
 - The quick and dirty way, just clone the TargetLoweringObjectFile
   code. Eventually this should be shared... somehow.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80168 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/llvm-mc/AsmParser.h b/tools/llvm-mc/AsmParser.h
index 21a7f46..8ab4b43 100644
--- a/tools/llvm-mc/AsmParser.h
+++ b/tools/llvm-mc/AsmParser.h
@@ -18,6 +18,7 @@
 #include "AsmLexer.h"
 #include "AsmCond.h"
 #include "llvm/MC/MCAsmParser.h"
+#include "llvm/MC/MCSectionMachO.h"
 #include "llvm/MC/MCStreamer.h"
 
 namespace llvm {
@@ -40,10 +41,15 @@
   AsmCond TheCondState;
   std::vector<AsmCond> TheCondStack;
 
+  // FIXME: Figure out where this should leave, the code is a copy of that which
+  // is also used by TargetLoweringObjectFile.
+  mutable void *SectionUniquingMap;
+
 public:
   AsmParser(SourceMgr &_SM, MCContext &_Ctx, MCStreamer &_Out)
-    : Lexer(_SM), Ctx(_Ctx), Out(_Out), TargetParser(0) {}
-  ~AsmParser() {}
+    : Lexer(_SM), Ctx(_Ctx), Out(_Out), TargetParser(0),
+      SectionUniquingMap(0) {}
+  ~AsmParser();
 
   bool Run();
   
@@ -71,6 +77,13 @@
 private:
   MCSymbol *CreateSymbol(StringRef Name);
 
+  // FIXME: See comment on SectionUniquingMap.
+  const MCSection *getMachOSection(const StringRef &Segment,
+                                   const StringRef &Section,
+                                   unsigned TypeAndAttributes,
+                                   unsigned Reserved2,
+                                   SectionKind Kind) const;
+
   bool ParseStatement();
 
   bool TokError(const char *Msg);