[llvm] [LLVM][DWARF] Chnage order for .debug_names abbrev print out (PR #80229)
Felipe de Azevedo Piovezan via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 1 15:37:20 PST 2024
================
@@ -847,8 +847,15 @@ void DWARFDebugNames::NameIndex::dumpForeignTUs(ScopedPrinter &W) const {
void DWARFDebugNames::NameIndex::dumpAbbreviations(ScopedPrinter &W) const {
ListScope AbbrevsScope(W, "Abbreviations");
- for (const auto &Abbr : Abbrevs)
- Abbr.dump(W);
+ std::vector<const Abbrev *> AbbrevsVect;
+ for (const llvm::DWARFDebugNames::Abbrev &Abbr : Abbrevs)
+ AbbrevsVect.push_back(&Abbr);
+ std::sort(AbbrevsVect.begin(), AbbrevsVect.end(),
----------------
felipepiovezan wrote:
We should never use `std::sort`, instead using the range-based (with some shuffling magic for expensive asserts) sort from stl extras:
```
sort(AbbrevVect, [] (...){});
```
https://llvm.org/docs/CodingStandards.html#beware-of-non-deterministic-sorting-order-of-equal-elements
https://github.com/llvm/llvm-project/pull/80229
More information about the llvm-commits
mailing list