From 59b604983e816658e3fae7b3912ec11191cea728 Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Mon, 11 Aug 2014 21:05:57 +0000 Subject: [PATCH 1/1] Debug info: Further simplify the implementation of buildLocationList by getting rid of the redundant DIVariable in the OpenRanges pair. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215385 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index b0ed22a5f4..57dda88b00 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -1233,8 +1233,7 @@ static bool piecesOverlap(DIVariable P1, DIVariable P2) { void DwarfDebug::buildLocationList(SmallVectorImpl &DebugLoc, const DbgValueHistoryMap::InstrRanges &Ranges) { - typedef std::pair Range; - SmallVector OpenRanges; + SmallVector OpenRanges; for (auto I = Ranges.begin(), E = Ranges.end(); I != E; ++I) { const MachineInstr *Begin = I->first; @@ -1251,9 +1250,10 @@ DwarfDebug::buildLocationList(SmallVectorImpl &DebugLoc, // If this piece overlaps with any open ranges, truncate them. DIVariable DIVar = Begin->getDebugVariable(); - auto Last = std::remove_if(OpenRanges.begin(), OpenRanges.end(), [&](Range R){ - return piecesOverlap(DIVar, R.first); - }); + auto Last = std::remove_if(OpenRanges.begin(), OpenRanges.end(), + [&](DebugLocEntry::Value R) { + return piecesOverlap(DIVar, DIVariable(R.getVariable())); + }); OpenRanges.erase(Last, OpenRanges.end()); const MCSymbol *StartLabel = getLabelBeforeInsn(Begin); @@ -1277,7 +1277,7 @@ DwarfDebug::buildLocationList(SmallVectorImpl &DebugLoc, // If this is a piece, it may belong to the current DebugLocEntry. if (DIVar.isVariablePiece()) { // Add this value to the list of open ranges. - OpenRanges.push_back(std::make_pair(DIVar, Value)); + OpenRanges.push_back(Value); // Attempt to add the piece to the last entry. if (!DebugLoc.empty()) -- 2.39.2