File indexing completed on 2026-05-10 08:44:37
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef LLVM_TESTING_ADT_STRINGMAP_H_
0010 #define LLVM_TESTING_ADT_STRINGMAP_H_
0011
0012 #include "llvm/ADT/STLExtras.h"
0013 #include "llvm/ADT/StringMap.h"
0014 #include "llvm/Support/FormatVariadic.h"
0015 #include "llvm/Testing/ADT/StringMapEntry.h"
0016 #include <ostream>
0017 #include <sstream>
0018
0019 namespace llvm {
0020
0021
0022
0023 template <typename T>
0024 std::ostream &operator<<(std::ostream &OS, const StringMap<T> &M) {
0025 if (M.empty()) {
0026 return OS << "{ }";
0027 }
0028
0029 std::vector<std::string> Lines;
0030 for (const auto &E : M) {
0031 std::ostringstream SS;
0032 SS << E << ",";
0033 Lines.push_back(SS.str());
0034 }
0035 llvm::sort(Lines);
0036 Lines.insert(Lines.begin(), "{");
0037 Lines.insert(Lines.end(), "}");
0038
0039 return OS << llvm::formatv("{0:$[\n]}",
0040 make_range(Lines.begin(), Lines.end()))
0041 .str();
0042 }
0043
0044 }
0045
0046 #endif