From d1294d9bb316afe3ca4630f62150594f18672b16 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Tue, 7 Apr 2015 12:59:28 +0000 Subject: Clear the stub map in getSortedStubs. This makes sure they are only output once (and frees a bit of memory). llvm-svn: 234313 --- llvm/lib/CodeGen/MachineModuleInfoImpls.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'llvm/lib/CodeGen/MachineModuleInfoImpls.cpp') diff --git a/llvm/lib/CodeGen/MachineModuleInfoImpls.cpp b/llvm/lib/CodeGen/MachineModuleInfoImpls.cpp index a1c7e9f5fb2..22d519e5d88 100644 --- a/llvm/lib/CodeGen/MachineModuleInfoImpls.cpp +++ b/llvm/lib/CodeGen/MachineModuleInfoImpls.cpp @@ -31,15 +31,14 @@ static int SortSymbolPair(const void *LHS, const void *RHS) { return LHSS->getName().compare(RHSS->getName()); } -/// GetSortedStubs - Return the entries from a DenseMap in a deterministic -/// sorted orer. -MachineModuleInfoImpl::SymbolListTy -MachineModuleInfoImpl::GetSortedStubs(const DenseMap&Map) { +MachineModuleInfoImpl::SymbolListTy MachineModuleInfoImpl::getSortedStubs( + DenseMap &Map) { MachineModuleInfoImpl::SymbolListTy List(Map.begin(), Map.end()); if (!List.empty()) qsort(&List[0], List.size(), sizeof(List[0]), SortSymbolPair); + + Map.clear(); return List; } -- cgit v1.2.3