aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-04-09 05:43:19 +0000
committerChris Lattner <sabre@nondot.org>2002-04-09 05:43:19 +0000
commit918c4ecb0c1c85adad760fb9d7faae088171d324 (patch)
tree9a10f948d9a3537b8e585c842a2df2f7c6d86486 /lib
parent1d21f3eb1d86a3e6dc0761f40ebaa81c819d2656 (diff)
downloadexternal_llvm-918c4ecb0c1c85adad760fb9d7faae088171d324.zip
external_llvm-918c4ecb0c1c85adad760fb9d7faae088171d324.tar.gz
external_llvm-918c4ecb0c1c85adad760fb9d7faae088171d324.tar.bz2
Don't leak all of the Loop objects created...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2196 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Analysis/LoopInfo.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/Analysis/LoopInfo.cpp b/lib/Analysis/LoopInfo.cpp
index cd7768f..ef47936 100644
--- a/lib/Analysis/LoopInfo.cpp
+++ b/lib/Analysis/LoopInfo.cpp
@@ -22,13 +22,21 @@ bool cfg::Loop::contains(const BasicBlock *BB) const {
return find(Blocks.begin(), Blocks.end(), BB) != Blocks.end();
}
+void cfg::LoopInfo::releaseMemory() {
+ for (std::vector<Loop*>::iterator I = TopLevelLoops.begin(),
+ E = TopLevelLoops.end(); I != E; ++I)
+ delete *I; // Delete all of the loops...
+
+ BBMap.clear(); // Reset internal state of analysis
+ TopLevelLoops.clear();
+}
+
//===----------------------------------------------------------------------===//
// cfg::LoopInfo implementation
//
bool cfg::LoopInfo::runOnMethod(Function *F) {
- BBMap.clear(); // Reset internal state of analysis
- TopLevelLoops.clear();
+ releaseMemory();
Calculate(getAnalysis<DominatorSet>()); // Update
return false;
}