D118181 leverages the iteration order of StringSet, which is not
guaranteed to be deterministic.
// YAML: Line: [[@LINE+1]]
int main() { return 0; }
-// CHECK: main
-// CHECK: a
-// CHECK: b
+// CHECK: a
+// CHECK-NEXT: b
+// CHECK-NEXT: main
// CHECK: Counters section size: 0x18 bytes
// CHECK: Found 3 functions
inline StringRef getNameData() const { return Data; }
/// Dump the symbols in this table.
- void dumpNames(raw_ostream &OS) const {
- for (StringRef S : NameTab.keys())
- OS << S << "\n";
- }
+ void dumpNames(raw_ostream &OS) const;
};
Error InstrProfSymtab::create(StringRef D, uint64_t BaseAddr) {
return 0;
}
+void InstrProfSymtab::dumpNames(raw_ostream &OS) const {
+ SmallVector<StringRef, 0> Sorted(NameTab.keys());
+ llvm::sort(Sorted);
+ for (StringRef S : Sorted)
+ OS << S << '\n';
+}
+
Error collectPGOFuncNameStrings(ArrayRef<std::string> NameStrs,
bool doCompression, std::string &Result) {
assert(!NameStrs.empty() && "No name data to emit");