[cfe-commits] r61163 - /cfe/trunk/lib/AST/ASTContext.cpp

Nuno Lopes nunoplopes at sapo.pt
Wed Dec 17 14:30:26 PST 2008


Author: nlopes
Date: Wed Dec 17 16:30:25 2008
New Revision: 61163

URL: http://llvm.org/viewvc/llvm-project?rev=61163&view=rev
Log:
fix a few more memory leaks: clean the ASTRecordLayouts, ASTObjCInterfaces and ASTRecordForInterface maps

Modified:
    cfe/trunk/lib/AST/ASTContext.cpp

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=61163&r1=61162&r2=61163&view=diff

==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Wed Dec 17 16:30:25 2008
@@ -48,6 +48,33 @@
     Types.pop_back();
   }
 
+  {
+    llvm::DenseMap<const RecordDecl*, const ASTRecordLayout*>::iterator
+      I = ASTRecordLayouts.begin(), E = ASTRecordLayouts.end();
+    while (I != E) {
+      ASTRecordLayout *R = const_cast<ASTRecordLayout*>((I++)->second);
+      delete R;
+    }
+  }
+
+  {
+    llvm::DenseMap<const ObjCInterfaceDecl*, const ASTRecordLayout*>::iterator
+      I = ASTObjCInterfaces.begin(), E = ASTObjCInterfaces.end();
+    while (I != E) {
+      ASTRecordLayout *R = const_cast<ASTRecordLayout*>((I++)->second);
+      delete R;
+    }
+  }
+
+  {
+    llvm::DenseMap<const ObjCInterfaceDecl*, const RecordDecl*>::iterator
+      I = ASTRecordForInterface.begin(), E = ASTRecordForInterface.end();
+    while (I != E) {
+      RecordDecl *R = const_cast<RecordDecl*>((I++)->second);
+      R->Destroy(*this);
+    }
+  }
+
   TUDecl->Destroy(*this);
 }
 





More information about the cfe-commits mailing list