summaryrefslogtreecommitdiff
path: root/lib/MC/MCContext.cpp
diff options
context:
space:
mode:
authorPedro Artigas <partigas@apple.com>2012-12-12 22:59:46 +0000
committerPedro Artigas <partigas@apple.com>2012-12-12 22:59:46 +0000
commit5399d2502acaf96fe8420e61913e77f0b23650ff (patch)
tree0a88b5a320500c2eeae8320ce4bd46014af30ef9 /lib/MC/MCContext.cpp
parent5749801caaf523e2e151eea4cacc87299a4b3822 (diff)
downloadllvm-5399d2502acaf96fe8420e61913e77f0b23650ff.tar.gz
llvm-5399d2502acaf96fe8420e61913e77f0b23650ff.tar.bz2
llvm-5399d2502acaf96fe8420e61913e77f0b23650ff.tar.xz
Make the MCStreamer have a reset method and call that after finalization of the asm printer,
also changed MCContext to a single reset only method for simplicity as requested on the list git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170041 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MCContext.cpp')
-rw-r--r--lib/MC/MCContext.cpp34
1 files changed, 15 insertions, 19 deletions
diff --git a/lib/MC/MCContext.cpp b/lib/MC/MCContext.cpp
index 23ec0bb12d..19ff49cd8f 100644
--- a/lib/MC/MCContext.cpp
+++ b/lib/MC/MCContext.cpp
@@ -32,13 +32,14 @@ typedef StringMap<const MCSectionCOFF*> COFFUniqueMapTy;
MCContext::MCContext(const MCAsmInfo &mai, const MCRegisterInfo &mri,
const MCObjectFileInfo *mofi, const SourceMgr *mgr,
- bool DoAutoInitializationFinalization ) :
+ bool DoAutoReset ) :
SrcMgr(mgr), MAI(mai), MRI(mri), MOFI(mofi),
Allocator(), Symbols(Allocator), UsedNames(Allocator),
- NextUniqueID(0),
- CurrentDwarfLoc(0,0,0,DWARF2_FLAG_IS_STMT,0,0),
- AllowTemporaryLabels(true),
- AutoInitializationFinalization(DoAutoInitializationFinalization) {
+ NextUniqueID(0),
+ CurrentDwarfLoc(0,0,0,DWARF2_FLAG_IS_STMT,0,0),
+ DwarfLocSeen(false), GenDwarfForAssembly(false), GenDwarfFileNumber(0),
+ AllowTemporaryLabels(true), AutoReset(DoAutoReset) {
+
MachOUniquingMap = 0;
ELFUniquingMap = 0;
COFFUniquingMap = 0;
@@ -46,15 +47,12 @@ MCContext::MCContext(const MCAsmInfo &mai, const MCRegisterInfo &mri,
SecureLogFile = getenv("AS_SECURE_LOG_FILE");
SecureLog = 0;
SecureLogUsed = false;
-
- if (AutoInitializationFinalization)
- doInitialization();
}
MCContext::~MCContext() {
- if (AutoInitializationFinalization)
- doFinalization();
+ if (AutoReset)
+ reset();
// NOTE: The symbols are all allocated out of a bump pointer allocator,
// we don't need to free them here.
@@ -67,15 +65,7 @@ MCContext::~MCContext() {
// Module Lifetime Management
//===----------------------------------------------------------------------===//
-void MCContext::doInitialization() {
- NextUniqueID = 0;
- AllowTemporaryLabels = true;
- DwarfLocSeen = false;
- GenDwarfForAssembly = false;
- GenDwarfFileNumber = 0;
-}
-
-void MCContext::doFinalization() {
+void MCContext::reset() {
UsedNames.clear();
Symbols.clear();
Allocator.Reset();
@@ -95,6 +85,12 @@ void MCContext::doFinalization() {
MachOUniquingMap = 0;
ELFUniquingMap = 0;
COFFUniquingMap = 0;
+
+ NextUniqueID = 0;
+ AllowTemporaryLabels = true;
+ DwarfLocSeen = false;
+ GenDwarfForAssembly = false;
+ GenDwarfFileNumber = 0;
}
//===----------------------------------------------------------------------===//