aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/clang/Lex/ModuleMap.h4
-rw-r--r--lib/Lex/ModuleMap.cpp15
2 files changed, 18 insertions, 1 deletions
diff --git a/include/clang/Lex/ModuleMap.h b/include/clang/Lex/ModuleMap.h
index e9bf1b35c1..b1eaebddb2 100644
--- a/include/clang/Lex/ModuleMap.h
+++ b/include/clang/Lex/ModuleMap.h
@@ -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; }
diff --git a/lib/Lex/ModuleMap.cpp b/lib/Lex/ModuleMap.cpp
index 0c51659cab..393118110a 100644
--- a/lib/Lex/ModuleMap.cpp
+++ b/lib/Lex/ModuleMap.cpp
@@ -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;
}