From bf32f773ccd4f200228259ef32249ad0bc7838a6 Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Fri, 25 Jul 2014 04:30:11 +0000 Subject: [PATCH] llvm-vtabledump: use a std::map instead of a StringMap for VBTables StringMap doesn't guarantee any particular iteration order, this is suboptimal when comparing llvm-vtabledump's output for two object files. llvm-svn: 213921 --- llvm/tools/llvm-vtabledump/llvm-vtabledump.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/llvm/tools/llvm-vtabledump/llvm-vtabledump.cpp b/llvm/tools/llvm-vtabledump/llvm-vtabledump.cpp index ce2e9b6..da08b7d 100644 --- a/llvm/tools/llvm-vtabledump/llvm-vtabledump.cpp +++ b/llvm/tools/llvm-vtabledump/llvm-vtabledump.cpp @@ -15,7 +15,6 @@ #include "llvm-vtabledump.h" #include "Error.h" #include "llvm/ADT/ArrayRef.h" -#include "llvm/ADT/StringMap.h" #include "llvm/Object/Archive.h" #include "llvm/Object/ObjectFile.h" #include "llvm/Support/Debug.h" @@ -71,7 +70,7 @@ static void reportError(StringRef Input, std::error_code EC) { static void dumpVTables(const ObjectFile *Obj) { std::map, StringRef> VFTableEntries; - StringMap> VBTables; + std::map> VBTables; for (const object::SymbolRef &Sym : Obj->symbols()) { StringRef SymName; if (error(Sym.getName(SymName))) @@ -126,12 +125,13 @@ static void dumpVTables(const ObjectFile *Obj) { StringRef SymName = VFTableEntry.second; outs() << VFTableName << '[' << Offset << "]: " << SymName << '\n'; } - for (const StringMapEntry> &VBTable : VBTables) { - StringRef VBTableName = VBTable.getKey(); + for (const std::pair> &VBTable : + VBTables) { + StringRef VBTableName = VBTable.first; uint32_t Idx = 0; - for (aligned_little32_t Offset : VBTable.getValue()) { + for (aligned_little32_t Offset : VBTable.second) { outs() << VBTableName << '[' << Idx << "]: " << Offset << '\n'; - Idx += sizeof(aligned_little32_t); + Idx += sizeof(Offset); } } } -- 2.7.4