llvm-mc: Add MCContext to MCAssembler.
authorDaniel Dunbar <daniel@zuster.org>
Mon, 31 Aug 2009 08:07:55 +0000 (08:07 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Mon, 31 Aug 2009 08:07:55 +0000 (08:07 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80572 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/MC/MCAssembler.h
lib/MC/MCAssembler.cpp
lib/MC/MCMachOStreamer.cpp

index 182d2fe4d0a88c88e5315e3e1cb359b21325f334..adafcd61583b4cfec29ca686dce57118870df97c 100644 (file)
@@ -21,6 +21,7 @@
 namespace llvm {
 class raw_ostream;
 class MCAssembler;
+class MCContext;
 class MCSection;
 class MCSectionData;
 
@@ -559,6 +560,8 @@ private:
   MCAssembler(const MCAssembler&);    // DO NOT IMPLEMENT
   void operator=(const MCAssembler&); // DO NOT IMPLEMENT
 
+  MCContext &Context;
+
   raw_ostream &OS;
   
   iplist<MCSectionData> Sections;
@@ -584,9 +587,11 @@ public:
   // concrete and require clients to pass in a target like object. The other
   // option is to make this abstract, and have targets provide concrete
   // implementations as we do with AsmParser.
-  MCAssembler(raw_ostream &OS);
+  MCAssembler(MCContext &_Context, raw_ostream &OS);
   ~MCAssembler();
 
+  MCContext &getContext() const { return Context; }
+
   /// Finish - Do final processing and write the object to the output stream.
   void Finish();
 
index 0d9b540d15eff00f644387dea5cc18996446a045..fe3d2d13a3bea44ff846752c54a455ee3509817c 100644 (file)
@@ -940,9 +940,8 @@ MCSymbolData::MCSymbolData(MCSymbol &_Symbol, MCFragment *_Fragment,
 
 /* *** */
 
-MCAssembler::MCAssembler(raw_ostream &_OS)
-  : OS(_OS),
-    SubsectionsViaSymbols(false)
+MCAssembler::MCAssembler(MCContext &_Context, raw_ostream &_OS)
+  : Context(_Context), OS(_OS), SubsectionsViaSymbols(false)
 {
 }
 
index 41c82b3d4232ea80320312f377cdc08e4eb8ff3b..87ea99f224fcf3f64d949ad594ffbc4483d007d2 100644 (file)
@@ -83,7 +83,7 @@ private:
 
 public:
   MCMachOStreamer(MCContext &Context, raw_ostream &_OS, MCCodeEmitter *_Emitter)
-    : MCStreamer(Context), Assembler(_OS), Emitter(_Emitter),
+    : MCStreamer(Context), Assembler(Context, _OS), Emitter(_Emitter),
       CurSectionData(0) {}
   ~MCMachOStreamer() {}