MC: Destroy Macro instances.
authorDaniel Dunbar <daniel@zuster.org>
Thu, 29 Jul 2010 01:51:55 +0000 (01:51 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Thu, 29 Jul 2010 01:51:55 +0000 (01:51 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109720 91177308-0d34-0410-b5e6-96231b3b80d8

lib/MC/MCParser/AsmParser.cpp

index e74952a4cab481ff0773ddce1f822e7a1cbc8d50..f4de09a1c0a6045c091e65c389e4dffbf07db83d 100644 (file)
@@ -279,6 +279,13 @@ AsmParser::AsmParser(const Target &T, SourceMgr &_SM, MCContext &_Ctx,
 }
 
 AsmParser::~AsmParser() {
+  assert(ActiveMacros.empty() && "Unexpected active macro instantiation!");
+
+  // Destroy any macros.
+  for (StringMap<Macro*>::iterator it = MacroMap.begin(),
+         ie = MacroMap.end(); it != ie; ++it)
+    delete it->getValue();
+
   delete PlatformParser;
   delete GenericParser;
 }