LLVM: lib/DebugInfo/PDB/Native/FormatUtil.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
10
17
18using namespace llvm;
21
25 std::string Result;
26 while (!Opts.empty()) {
28 ThisGroup = Opts.take_front(GroupSize);
30 Result += join(ThisGroup, Sep);
31 if (!Opts.empty()) {
32 Result += Sep;
33 Result += "\n";
34 Result += std::string(formatv("{0}", fmt_repeat(' ', IndentLevel)));
35 }
36 }
37 return Result;
38}
39
42 std::string Result = "[";
43 for (const auto &S : Strings) {
44 Result += std::string(formatv("\n{0}{1}", fmt_repeat(' ', IndentLevel), S));
45 }
46 Result += "]";
47 return Result;
48}
49
51 bool Friendly) {
52 if (Friendly) {
53 switch (Kind) {
67 "merged assembly input");
71 }
72 } else {
73 switch (Kind) {
82 "DEBUG_S_CROSSSCOPEIMPORTS");
84 "DEBUG_S_CROSSSCOPEEXPORTS");
87 "DEBUG_S_FUNC_MDTOKEN_MAP");
89 "DEBUG_S_TYPE_MDTOKEN_MAP");
91 "DEBUG_S_MERGED_ASSEMBLYINPUT");
93 "DEBUG_S_COFF_SYMBOL_RVA");
95 "DEBUG_S_XFGHASH_TYPE");
97 "DEBUG_S_XFGHASH_VIRTUAL");
98
99 }
100 }
102}
103
106#define SYMBOL_RECORD(EnumName, value, name) \
107 case EnumName: \
108 return #EnumName;
109#define CV_SYMBOL(EnumName, value) SYMBOL_RECORD(EnumName, value, EnumName)
110#include "llvm/DebugInfo/CodeView/CodeViewSymbols.def"
111 }
113}
114
116 switch (K) {
117#define TYPE_RECORD(EnumName, value, name) \
118 case EnumName: \
119 return #EnumName;
120#include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
121 default:
123 }
124}
125
127 return std::string(formatv("{0:4}:{1:4}", Segment, Offset));
128}
129
130#define PUSH_CHARACTERISTIC_FLAG(Enum, TheOpt, Value, Style, Descriptive) \
131 PUSH_FLAG(Enum, TheOpt, Value, \
132 ((Style == CharacteristicStyle::HeaderDefinition) ? #TheOpt \
133 : Descriptive))
134
135#define PUSH_MASKED_CHARACTERISTIC_FLAG(Enum, Mask, TheOpt, Value, Style, \
136 Descriptive) \
137 PUSH_MASKED_FLAG(Enum, Mask, TheOpt, Value, \
138 ((Style == CharacteristicStyle::HeaderDefinition) \
139 ? #TheOpt \
140 : Descriptive))
141
148 std::vectorstd::string Opts;
150 return "invalid";
151 if (C == 0)
152 return "none";
157 "initialized data");
159 "uninitialized data");
170 Style, "1 byte align");
172 Style, "2 byte align");
174 Style, "4 byte align");
176 Style, "8 byte align");
178 Style, "16 byte align");
180 Style, "32 byte align");
182 Style, "64 byte align");
184 Style, "128 byte align");
186 Style, "256 byte align");
188 Style, "512 byte align");
190 Style, "1024 byte align");
192 Style, "2048 byte align");
194 Style, "4096 byte align");
196 Style, "8192 byte align");
198 "noreloc overflow");
200 "discardable");
202 "not cached");
206 "execute permissions");
208 "read permissions");
210 "write permissions");
211 return typesetItemList(Opts, IndentLevel, FlagsPerLine, Separator);
212}
#define PUSH_CHARACTERISTIC_FLAG(Enum, TheOpt, Value, Style, Descriptive)
Definition FormatUtil.cpp:130
#define PUSH_MASKED_CHARACTERISTIC_FLAG(Enum, Mask, TheOpt, Value, Style, Descriptive)
Definition FormatUtil.cpp:135
#define RETURN_CASE(Enum, X, Ret)
This file contains library features backported from future STL versions.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
ArrayRef< T > take_front(size_t N=1) const
Return a copy of *this with only the first N elements.
ArrayRef< T > drop_front(size_t N=1) const
Drop the first N elements of the array.
size_t size() const
size - Get the array size.
bool empty() const
empty - Check if the array is empty.
StringRef - Represent a constant reference to a string, i.e.
A table of densely packed, null-terminated strings indexed by offset.
@ C
The default llvm calling convention, compatible with C.
TypeLeafKind
Duplicate copy of the above enum, but using the official CV names.
SymbolKind
Duplicate copy of the above enum, but using the official CV names.
LLVM_ABI std::string formatSegmentOffset(uint16_t Segment, uint32_t Offset)
Definition FormatUtil.cpp:126
std::string formatUnknownEnum(T Value)
LLVM_ABI std::string typesetStringList(uint32_t IndentLevel, ArrayRef< StringRef > Strings)
Definition FormatUtil.cpp:40
LLVM_ABI std::string formatSymbolKind(codeview::SymbolKind K)
Definition FormatUtil.cpp:104
LLVM_ABI std::string formatTypeLeafKind(codeview::TypeLeafKind K)
Definition FormatUtil.cpp:115
LLVM_ABI std::string formatChunkKind(codeview::DebugSubsectionKind Kind, bool Friendly=true)
Definition FormatUtil.cpp:50
LLVM_ABI std::string formatSectionCharacteristics(uint32_t IndentLevel, uint32_t C, uint32_t FlagsPerLine, StringRef Separator, CharacteristicStyle Style=CharacteristicStyle::HeaderDefinition)
Definition FormatUtil.cpp:142
LLVM_ABI std::string typesetItemList(ArrayRef< std::string > Opts, uint32_t IndentLevel, uint32_t GroupSize, StringRef Sep)
Definition FormatUtil.cpp:22
This is an optimization pass for GlobalISel generic memory operations.
auto formatv(bool Validate, const char *Fmt, Ts &&...Vals)
constexpr std::underlying_type_t< Enum > to_underlying(Enum E)
Returns underlying integer value of an enum.
support::detail::RepeatAdapter< T > fmt_repeat(T &&Item, size_t Count)
std::string join(IteratorT Begin, IteratorT End, StringRef Separator)
Joins the strings in the range [Begin, End), adding Separator between the elements.