llvm-mc: Add MCContext to MCAssembler.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80572 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/llvm/MC/MCAssembler.h b/include/llvm/MC/MCAssembler.h
index 182d2fe..adafcd6 100644
--- a/include/llvm/MC/MCAssembler.h
+++ b/include/llvm/MC/MCAssembler.h
@@ -21,6 +21,7 @@
namespace llvm {
class raw_ostream;
class MCAssembler;
+class MCContext;
class MCSection;
class MCSectionData;
@@ -559,6 +560,8 @@
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 @@
// 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();
diff --git a/lib/MC/MCAssembler.cpp b/lib/MC/MCAssembler.cpp
index 0d9b540..fe3d2d1 100644
--- a/lib/MC/MCAssembler.cpp
+++ b/lib/MC/MCAssembler.cpp
@@ -940,9 +940,8 @@
/* *** */
-MCAssembler::MCAssembler(raw_ostream &_OS)
- : OS(_OS),
- SubsectionsViaSymbols(false)
+MCAssembler::MCAssembler(MCContext &_Context, raw_ostream &_OS)
+ : Context(_Context), OS(_OS), SubsectionsViaSymbols(false)
{
}
diff --git a/lib/MC/MCMachOStreamer.cpp b/lib/MC/MCMachOStreamer.cpp
index 41c82b3..87ea99f 100644
--- a/lib/MC/MCMachOStreamer.cpp
+++ b/lib/MC/MCMachOStreamer.cpp
@@ -83,7 +83,7 @@
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() {}