File indexing completed on 2026-05-10 08:43:39
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef LLVM_DEBUGINFO_CODEVIEW_FORMATTERS_H
0010 #define LLVM_DEBUGINFO_CODEVIEW_FORMATTERS_H
0011
0012 #include "llvm/ADT/ArrayRef.h"
0013 #include "llvm/ADT/StringRef.h"
0014 #include "llvm/DebugInfo/CodeView/GUID.h"
0015 #include "llvm/DebugInfo/CodeView/TypeIndex.h"
0016 #include "llvm/Support/FormatAdapters.h"
0017 #include "llvm/Support/FormatVariadic.h"
0018 #include "llvm/Support/raw_ostream.h"
0019 #include <cstdint>
0020
0021 namespace llvm {
0022
0023 namespace codeview {
0024
0025 struct GUID;
0026
0027 namespace detail {
0028
0029 class GuidAdapter final : public FormatAdapter<ArrayRef<uint8_t>> {
0030 ArrayRef<uint8_t> Guid;
0031
0032 public:
0033 explicit GuidAdapter(ArrayRef<uint8_t> Guid);
0034 explicit GuidAdapter(StringRef Guid);
0035
0036 void format(raw_ostream &Stream, StringRef Style) override;
0037 };
0038
0039 }
0040
0041 inline detail::GuidAdapter fmt_guid(StringRef Item) {
0042 return detail::GuidAdapter(Item);
0043 }
0044
0045 inline detail::GuidAdapter fmt_guid(ArrayRef<uint8_t> Item) {
0046 return detail::GuidAdapter(Item);
0047 }
0048
0049 }
0050
0051 template <> struct format_provider<codeview::TypeIndex> {
0052 public:
0053 static void format(const codeview::TypeIndex &V, raw_ostream &Stream,
0054 StringRef Style) {
0055 if (V.isNoneType())
0056 Stream << "<no type>";
0057 else {
0058 Stream << formatv("{0:X+4}", V.getIndex());
0059 if (V.isSimple())
0060 Stream << " (" << codeview::TypeIndex::simpleTypeName(V) << ")";
0061 }
0062 }
0063 };
0064
0065 template <> struct format_provider<codeview::GUID> {
0066 static void format(const codeview::GUID &V, llvm::raw_ostream &Stream,
0067 StringRef Style) {
0068 Stream << V;
0069 }
0070 };
0071
0072 }
0073
0074 #endif