Skip to content

Commit e88fee1

Browse files
committed
AppleAcceleratorTable: Use MapVector to stabilize iteration order after D153066
Use a MapVector to stabilize the order and simplify future changes like D142862 that change the StringMap hash function.
1 parent 60a2b99 commit e88fee1

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

llvm/test/DebugInfo/Generic/apple-names-hash-collisions.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
; FOUND_VARS: DW_AT_name ("bb")
1616
; FOUND_VARS: DW_AT_name ("cA")
1717

18+
; ALL_ENTRIES: Apple accelerator entries with name = "bb":
19+
; ALL_ENTRIES: DW_AT_name ("bb")
1820
; ALL_ENTRIES: Apple accelerator entries with name = "cA":
1921
; ALL_ENTRIES: DW_AT_name ("cA")
2022
; ALL_ENTRIES: Apple accelerator entries with name = "some_other_hash":
2123
; ALL_ENTRIES: DW_AT_name ("some_other_hash")
2224
; ALL_ENTRIES: Apple accelerator entries with name = "int":
2325
; ALL_ENTRIES: DW_AT_name ("int")
24-
; ALL_ENTRIES: Apple accelerator entries with name = "bb":
25-
; ALL_ENTRIES: DW_AT_name ("bb")
2626

2727
@bb = global i32 200, align 4, !dbg !0
2828
@cA = global i32 10, align 4, !dbg !5

llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
#include "llvm-dwarfdump.h"
14+
#include "llvm/ADT/MapVector.h"
1415
#include "llvm/ADT/STLExtras.h"
1516
#include "llvm/ADT/SmallSet.h"
1617
#include "llvm/ADT/StringSet.h"
@@ -463,7 +464,7 @@ static void filterByAccelName(
463464
static void findAllApple(
464465
DWARFContext &DICtx, raw_ostream &OS,
465466
std::function<StringRef(uint64_t RegNum, bool IsEH)> GetNameForDWARFReg) {
466-
StringMap<llvm::SmallSet<DWARFDie, 2>> NameToDies;
467+
MapVector<StringRef, llvm::SmallSet<DWARFDie, 2>> NameToDies;
467468

468469
auto PushDIEs = [&](const AppleAcceleratorTable &Accel) {
469470
for (const auto &Entry : Accel.entries()) {

0 commit comments

Comments
 (0)