LiveInterval: Fix SubRange memory leak.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228405 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Matthias Braun
2015-02-06 17:28:47 +00:00
parent 1e022d0859
commit e81cc348ac
2 changed files with 24 additions and 4 deletions

View File

@@ -606,6 +606,10 @@ namespace llvm {
LiveInterval(unsigned Reg, float Weight)
: SubRanges(nullptr), reg(Reg), weight(Weight) {}
~LiveInterval() {
clearSubRanges();
}
template<typename T>
class SingleLinkedListIterator {
T *P;
@@ -681,9 +685,7 @@ namespace llvm {
}
/// Removes all subregister liveness information.
void clearSubRanges() {
SubRanges = nullptr;
}
void clearSubRanges();
/// Removes all subranges without any segments (subranges without segments
/// are not considered valid and should only exist temporarily).
@@ -733,6 +735,9 @@ namespace llvm {
Range->Next = SubRanges;
SubRanges = Range;
}
/// Free memory held by SubRange.
void freeSubRange(SubRange *S);
};
inline raw_ostream &operator<<(raw_ostream &OS, const LiveInterval &LI) {