Actually free memory for the module maps

llvm-svn: 144880
This commit is contained in:
Douglas Gregor 2011-11-17 02:05:44 +00:00
parent 667971778c
commit 5acdf59ebc
2 changed files with 18 additions and 1 deletions

View File

@ -73,7 +73,9 @@ public:
: Name(Name), DefinitionLoc(DefinitionLoc), Parent(Parent),
UmbrellaHeader(0), IsExplicit(IsExplicit) {
}
~Module();
/// \brief Determine whether this module is a submodule.
bool isSubModule() const { return Parent != 0; }

View File

@ -31,6 +31,15 @@ using namespace clang;
// Module
//----------------------------------------------------------------------------//
ModuleMap::Module::~Module() {
for (llvm::StringMap<Module *>::iterator I = SubModules.begin(),
IEnd = SubModules.end();
I != IEnd; ++I) {
delete I->getValue();
}
}
std::string ModuleMap::Module::getFullModuleName() const {
llvm::SmallVector<StringRef, 2> Names;
@ -72,6 +81,12 @@ ModuleMap::ModuleMap(FileManager &FileMgr, const DiagnosticConsumer &DC) {
}
ModuleMap::~ModuleMap() {
for (llvm::StringMap<Module *>::iterator I = Modules.begin(),
IEnd = Modules.end();
I != IEnd; ++I) {
delete I->getValue();
}
delete SourceMgr;
}