summaryrefslogtreecommitdiffstats
path: root/lib/MC
diff options
context:
space:
mode:
authorPedro Artigas <partigas@apple.com>2012-12-06 00:50:55 +0000
committerPedro Artigas <partigas@apple.com>2012-12-06 00:50:55 +0000
commit486a7ad94fc948a0f52c32c860cdb2b166741249 (patch)
treea67949f2ad5c11cacbab005deaa1656f718c7f27 /lib/MC
parent1c211640e53226540cd403948f5dd89c36c4beb8 (diff)
downloadexternal_llvm-486a7ad94fc948a0f52c32c860cdb2b166741249.zip
external_llvm-486a7ad94fc948a0f52c32c860cdb2b166741249.tar.gz
external_llvm-486a7ad94fc948a0f52c32c860cdb2b166741249.tar.bz2
change MCContext to work on the doInitialization/doFinalization model
reviewed by Evan Cheng <evan.cheng@apple.com> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169456 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC')
-rw-r--r--lib/MC/MCContext.cpp37
1 files changed, 31 insertions, 6 deletions
diff --git a/lib/MC/MCContext.cpp b/lib/MC/MCContext.cpp
index dd9d956..cd95b11 100644
--- a/lib/MC/MCContext.cpp
+++ b/lib/MC/MCContext.cpp
@@ -44,23 +44,48 @@ MCContext::MCContext(const MCAsmInfo &mai, const MCRegisterInfo &mri,
SecureLogFile = getenv("AS_SECURE_LOG_FILE");
SecureLog = 0;
SecureLogUsed = false;
+}
+
+MCContext::~MCContext() {
+ // NOTE: The symbols are all allocated out of a bump pointer allocator,
+ // we don't need to free them here.
+
+ // If the stream for the .secure_log_unique directive was created free it.
+ delete (raw_ostream*)SecureLog;
+}
+
+//===----------------------------------------------------------------------===//
+// Module Lifetime Management
+//===----------------------------------------------------------------------===//
+void MCContext::doInitialization() {
+ NextUniqueID = 0;
+ AllowTemporaryLabels = true;
DwarfLocSeen = false;
GenDwarfForAssembly = false;
GenDwarfFileNumber = 0;
}
-MCContext::~MCContext() {
- // NOTE: The symbols are all allocated out of a bump pointer allocator,
- // we don't need to free them here.
+void MCContext::doFinalization() {
+ UsedNames.clear();
+ Symbols.clear();
+ Allocator.Reset();
+ Instances.clear();
+ MCDwarfFiles.clear();
+ MCDwarfDirs.clear();
+ MCGenDwarfLabelEntries.clear();
+ DwarfDebugFlags = StringRef();
+ MCLineSections.clear();
+ MCLineSectionOrder.clear();
+ CurrentDwarfLoc = MCDwarfLoc(0,0,0,DWARF2_FLAG_IS_STMT,0,0);
// If we have the MachO uniquing map, free it.
delete (MachOUniqueMapTy*)MachOUniquingMap;
delete (ELFUniqueMapTy*)ELFUniquingMap;
delete (COFFUniqueMapTy*)COFFUniquingMap;
-
- // If the stream for the .secure_log_unique directive was created free it.
- delete (raw_ostream*)SecureLog;
+ MachOUniquingMap = 0;
+ ELFUniquingMap = 0;
+ COFFUniquingMap = 0;
}
//===----------------------------------------------------------------------===//