Fix a use-after-free in a DEBUG output.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238242 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Adrian Prantl 2015-05-26 20:06:48 +00:00
parent e4af3b4160
commit 74f44b6c69

View File

@ -857,10 +857,6 @@ DwarfDebug::buildLocationList(SmallVectorImpl<DebugLocEntry> &DebugLoc,
// Attempt to coalesce the ranges of two otherwise identical
// DebugLocEntries.
auto CurEntry = DebugLoc.rbegin();
auto PrevEntry = std::next(CurEntry);
if (PrevEntry != DebugLoc.rend() && PrevEntry->MergeRanges(*CurEntry))
DebugLoc.pop_back();
DEBUG({
dbgs() << CurEntry->getValues().size() << " Values:\n";
for (auto Value : CurEntry->getValues()) {
@ -868,6 +864,10 @@ DwarfDebug::buildLocationList(SmallVectorImpl<DebugLocEntry> &DebugLoc,
}
dbgs() << "-----\n";
});
auto PrevEntry = std::next(CurEntry);
if (PrevEntry != DebugLoc.rend() && PrevEntry->MergeRanges(*CurEntry))
DebugLoc.pop_back();
}
}