LLVM: include/llvm/Support/ScopedPrinter.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9#ifndef LLVM_SUPPORT_SCOPEDPRINTER_H
10#define LLVM_SUPPORT_SCOPEDPRINTER_H
11
23#include <type_traits>
24
25namespace llvm {
26
29
30
31
32
33
34
35
41};
42
44
45
46
47
60 template <typename EnumT, typename = std::enable_if_t<std::is_enum_v>>
62
64};
65
85 template <typename EnumT, typename = std::enable_if_t<std::is_enum_v>>
88
91};
92
94
101
102template <typename T, typename TEnum>
105 if (EnumItem.Value == Value)
106 return std::string(EnumItem.AltName);
108}
109
110
111
112
113template <typename T, typename TEnum>
116 if (EnumItem.Value == Value)
117 return EnumItem.AltName;
118 return "";
119}
120
122public:
127
130 : OS(OS), Kind(Kind) {}
131
133
137
139
141
142 void indent(int Levels = 1) { IndentLevel += Levels; }
143
145 IndentLevel = IndentLevel > Levels ? IndentLevel - Levels : 0;
146 }
147
149
151
153
155 OS << Prefix;
156 for (int i = 0; i < IndentLevel; ++i)
157 OS << " ";
158 }
159
161
162 template <typename T, typename TEnum>
166 bool Found = false;
167 for (const auto &EnumItem : EnumValues) {
168 if (EnumItem.Value == Value) {
169 Name = EnumItem.Name;
170 Found = true;
171 break;
172 }
173 }
174
175 if (Found)
177 else
179 }
180
181 template <typename T, typename TFlag>
183 TFlag EnumMask1 = {}, TFlag EnumMask2 = {},
184 TFlag EnumMask3 = {}, ArrayRef ExtraFlags = {}) {
185 SmallVector<FlagEntry, 10> SetFlags(ExtraFlags);
186
187 for (const auto &Flag : Flags) {
188 if (Flag.Value == TFlag{})
189 continue;
190
191 TFlag EnumMask{};
192 if ((Flag.Value & EnumMask1) != TFlag{})
193 EnumMask = EnumMask1;
194 else if ((Flag.Value & EnumMask2) != TFlag{})
195 EnumMask = EnumMask2;
196 else if ((Flag.Value & EnumMask3) != TFlag{})
197 EnumMask = EnumMask3;
198 bool IsEnum = (Flag.Value & EnumMask) != TFlag{};
199 if ((!IsEnum && (Value & Flag.Value) == Flag.Value) ||
200 (IsEnum && (Value & EnumMask) == Flag.Value)) {
201 SetFlags.emplace_back(Flag.Name, Flag.Value);
202 }
203 }
204
206 printFlagsImpl(Label, hex(Value), SetFlags);
207 }
208
213 while (Curr > 0) {
214 if (Curr & 1)
216 Curr >>= 1;
217 Flag <<= 1;
218 }
219 printFlagsImpl(Label, hex(Value), SetFlags);
220 }
221
223 startLine() << Label << ": " << static_cast<int>(Value) << "\n";
224 }
225
227 startLine() << Label << ": " << static_cast<int>(Value) << "\n";
228 }
229
231 startLine() << Label << ": " << static_cast<unsigned>(Value) << "\n";
232 }
233
237
241
245
249
253
257
261
265
269
273
277
278 template
282
284 startLine() << Label << ": " << (Value ? "Yes" : "No") << '\n';
285 }
286
287 template <typename T, typename... TArgs>
291 ((getOStream() << '.' << MinorVersions), ...);
293 }
294
295 template
298 for (const auto &Item : List)
301 }
302
304 printListImpl(Label, List);
305 }
306
308 printListImpl(Label, List);
309 }
310
312 printListImpl(Label, List);
313 }
314
316 printListImpl(Label, List);
317 }
318
320 printListImpl(Label, List);
321 }
322
327 printListImpl(Label, NumberList);
328 }
329
331 printListImpl(Label, List);
332 }
333
335 printListImpl(Label, List);
336 }
337
339 printListImpl(Label, List);
340 }
341
344 for (const int8_t &Item : List)
346 printListImpl(Label, NumberList);
347 }
348
350 printListImpl(Label, List);
351 }
352
353 template <typename T, typename U>
357 for (const auto &Item : List) {
358 OS << LS;
360 }
361 OS << "]\n";
362 }
363
366 for (const auto &Item : List)
368 printHexListImpl(Label, HexList);
369 }
370
372 printHexImpl(Label, hex(Value));
373 }
374
376 printHexImpl(Label, Str, hex(Value));
377 }
378
379 template
381 printSymbolOffsetImpl(Label, Symbol, hex(Value));
382 }
383
385
389
391 printStringEscapedImpl(Label, Value);
392 }
393
395 printBinaryImpl(Label, Str, Value, false);
396 }
397
399 auto V =
401 printBinaryImpl(Label, Str, V, false);
402 }
403
407
409 auto V =
411 printBinaryImpl(Label, StringRef(), V, false);
412 }
413
415 auto V =
417 printBinaryImpl(Label, StringRef(), V, false);
418 }
419
422 printBinaryImpl(Label, StringRef(), Value, true, StartOffset);
423 }
424
428
430 auto V =
432 printBinaryImpl(Label, StringRef(), V, true);
433 }
434
438
440
442
444
446
448
449 virtual void arrayEnd() { scopedEnd(']'); }
450
455
457
458private:
460 return LHS.Name < RHS.Name;
461 }
462
463 virtual void printBinaryImpl(StringRef Label, StringRef Str,
464 ArrayRef<uint8_t> Value, bool Block,
466
467 virtual void printFlagsImpl(StringRef Label, HexNumber Value,
468 ArrayRef Flags) {
469 startLine() << Label << " [ (" << Value << ")\n";
470 for (const auto &Flag : Flags)
471 startLine() << " " << Flag.Name << " (" << hex(Flag.Value) << ")\n";
472 startLine() << "]\n";
473 }
474
475 virtual void printFlagsImpl(StringRef Label, HexNumber Value,
476 ArrayRef Flags) {
477 startLine() << Label << " [ (" << Value << ")\n";
478 for (const auto &Flag : Flags)
479 startLine() << " " << Flag << '\n';
480 startLine() << "]\n";
481 }
482
483 template void printListImpl(StringRef Label, const T List) {
484 startLine() << Label << ": [";
485 ListSeparator LS;
486 for (const auto &Item : List)
487 OS << LS << Item;
488 OS << "]\n";
489 }
490
491 virtual void printHexListImpl(StringRef Label,
492 const ArrayRef List) {
493 startLine() << Label << ": [";
494 ListSeparator LS;
495 for (const auto &Item : List)
496 OS << LS << hex(Item);
497 OS << "]\n";
498 }
499
500 virtual void printHexImpl(StringRef Label, HexNumber Value) {
501 startLine() << Label << ": " << Value << "\n";
502 }
503
504 virtual void printHexImpl(StringRef Label, StringRef Str, HexNumber Value) {
505 startLine() << Label << ": " << Str << " (" << Value << ")\n";
506 }
507
508 virtual void printSymbolOffsetImpl(StringRef Label, StringRef Symbol,
509 HexNumber Value) {
510 startLine() << Label << ": " << Symbol << '+' << Value << '\n';
511 }
512
513 virtual void printNumberImpl(StringRef Label, StringRef Str,
514 StringRef Value) {
515 startLine() << Label << ": " << Str << " (" << Value << ")\n";
516 }
517
518 virtual void printStringEscapedImpl(StringRef Label, StringRef Value) {
519 startLine() << Label << ": ";
520 OS.write_escaped(Value);
521 OS << '\n';
522 }
523
524 void scopedBegin(char Symbol) {
525 startLine() << Symbol << '\n';
526 indent();
527 }
528
529 void scopedBegin(StringRef Label, char Symbol) {
530 startLine() << Label;
531 if (.empty())
532 OS << ' ';
533 OS << Symbol << '\n';
534 indent();
535 }
536
537 void scopedEnd(char Symbol) {
538 unindent();
539 startLine() << Symbol << '\n';
540 }
541
542 raw_ostream &OS;
543 int IndentLevel = 0;
545 ScopedPrinterKind Kind;
546};
547
548template <>
549inline void
552 startLine() << Label << ": " << hex(Value) << "\n";
553}
554
562
564private:
565 enum class Scope {
566 Array,
567 Object,
568 };
569
570 enum class ScopeKind {
571 NoAttribute,
572 Attribute,
573 NestedAttribute,
574 };
575
576 struct ScopeContext {
577 Scope Context;
578 ScopeKind Kind;
579 ScopeContext(Scope Context, ScopeKind Kind = ScopeKind::NoAttribute)
580 : Context(Context), Kind(Kind) {}
581 };
582
585 std::unique_ptr OuterScope;
586
587public:
589 std::unique_ptr &&OuterScope =
590 std::unique_ptr{});
591
595
597 JOS.attribute(Label, Value);
598 }
599
601 JOS.attribute(Label, Value);
602 }
603
605 JOS.attribute(Label, Value);
606 }
607
609 JOS.attribute(Label, Value);
610 }
611
613 JOS.attribute(Label, Value);
614 }
615
617 JOS.attribute(Label, Value);
618 }
619
621 JOS.attribute(Label, Value);
622 }
623
625 JOS.attribute(Label, Value);
626 }
627
629 JOS.attribute(Label, Value);
630 }
631
633 JOS.attribute(Label, Value);
634 }
635
637 JOS.attribute(Label, Value);
638 }
639
641 JOS.attribute(Label, Value);
642 }
643
645 JOS.attribute(Label, Value);
646 }
647
649 JOS.attributeBegin(Label);
650 printAPSInt(Value);
651 JOS.attributeEnd();
652 }
653
655 JOS.attribute(Label, Value);
656 }
657
659 printListImpl(Label, List);
660 }
661
663 printListImpl(Label, List);
664 }
665
667 printListImpl(Label, List);
668 }
669
671 printListImpl(Label, List);
672 }
673
675 printListImpl(Label, List);
676 }
677
679 printListImpl(Label, List);
680 }
681
683 printListImpl(Label, List);
684 }
685
687 printListImpl(Label, List);
688 }
689
691 printListImpl(Label, List);
692 }
693
695 printListImpl(Label, List);
696 }
697
699 JOS.attributeArray(Label, [&]() {
701 printAPSInt(Item);
702 }
703 });
704 }
705
707
709 JOS.attribute(Label, Value);
710 }
711
713 scopedBegin({Scope::Object, ScopeKind::NoAttribute});
714 }
715
717 scopedBegin(Label, Scope::Object);
718 }
719
721
723 scopedBegin({Scope::Array, ScopeKind::NoAttribute});
724 }
725
727 scopedBegin(Label, Scope::Array);
728 }
729
730 void arrayEnd() override { scopedEnd(); }
731
732private:
733
735
736 void printAPSInt(const APSInt &Value) {
739 }
740
741 void printFlagsImpl(StringRef Label, HexNumber Value,
743 JOS.attributeObject(Label, [&]() {
744 JOS.attribute("Value", hexNumberToInt(Value));
745 JOS.attributeArray("Flags", [&]() {
746 for (const FlagEntry &Flag : Flags) {
747 JOS.objectBegin();
748 JOS.attribute("Name", Flag.Name);
749 JOS.attribute("Value", Flag.Value);
750 JOS.objectEnd();
751 }
752 });
753 });
754 }
755
756 void printFlagsImpl(StringRef Label, HexNumber Value,
758 JOS.attributeObject(Label, [&]() {
759 JOS.attribute("Value", hexNumberToInt(Value));
760 JOS.attributeArray("Flags", [&]() {
761 for (const HexNumber &Flag : Flags) {
762 JOS.value(Flag.Value);
763 }
764 });
765 });
766 }
767
768 template void printListImpl(StringRef Label, const T &List) {
769 JOS.attributeArray(Label, [&]() {
770 for (const auto &Item : List)
771 JOS.value(Item);
772 });
773 }
774
775 void printHexListImpl(StringRef Label,
777 JOS.attributeArray(Label, [&]() {
778 for (const HexNumber &Item : List) {
779 JOS.value(hexNumberToInt(Item));
780 }
781 });
782 }
783
784 void printHexImpl(StringRef Label, HexNumber Value) override {
785 JOS.attribute(Label, hexNumberToInt(Value));
786 }
787
788 void printHexImpl(StringRef Label, StringRef Str, HexNumber Value) override {
789 JOS.attributeObject(Label, [&]() {
790 JOS.attribute("Name", Str);
791 JOS.attribute("Value", hexNumberToInt(Value));
792 });
793 }
794
795 void printSymbolOffsetImpl(StringRef Label, StringRef Symbol,
796 HexNumber Value) override {
797 JOS.attributeObject(Label, [&]() {
798 JOS.attribute("SymName", Symbol);
799 JOS.attribute("Offset", hexNumberToInt(Value));
800 });
801 }
802
803 void printNumberImpl(StringRef Label, StringRef Str,
804 StringRef Value) override {
805 JOS.attributeObject(Label, [&]() {
806 JOS.attribute("Name", Str);
807 JOS.attributeBegin("Value");
808 JOS.rawValueBegin() << Value;
809 JOS.rawValueEnd();
810 JOS.attributeEnd();
811 });
812 }
813
814 void printBinaryImpl(StringRef Label, StringRef Str, ArrayRef<uint8_t> Value,
815 bool Block, uint32_t StartOffset = 0) override {
816 JOS.attributeObject(Label, [&]() {
817 if (!Str.empty())
818 JOS.attribute("Value", Str);
819 JOS.attribute("Offset", StartOffset);
820 JOS.attributeArray("Bytes", [&]() {
821 for (uint8_t Val : Value)
822 JOS.value(Val);
823 });
824 });
825 }
826
827 void scopedBegin(ScopeContext ScopeCtx) {
828 if (ScopeCtx.Context == Scope::Object)
829 JOS.objectBegin();
830 else if (ScopeCtx.Context == Scope::Array)
831 JOS.arrayBegin();
832 ScopeHistory.push_back(ScopeCtx);
833 }
834
835 void scopedBegin(StringRef Label, Scope Ctx) {
836 ScopeKind Kind = ScopeKind::Attribute;
837 if (ScopeHistory.empty() || ScopeHistory.back().Context != Scope::Object) {
838 JOS.objectBegin();
839 Kind = ScopeKind::NestedAttribute;
840 }
841 JOS.attributeBegin(Label);
842 scopedBegin({Ctx, Kind});
843 }
844
845 void scopedEnd() {
846 ScopeContext ScopeCtx = ScopeHistory.back();
847 if (ScopeCtx.Context == Scope::Object)
848 JOS.objectEnd();
849 else if (ScopeCtx.Context == Scope::Array)
850 JOS.arrayEnd();
851 if (ScopeCtx.Kind == ScopeKind::Attribute ||
852 ScopeCtx.Kind == ScopeKind::NestedAttribute)
853 JOS.attributeEnd();
854 if (ScopeCtx.Kind == ScopeKind::NestedAttribute)
855 JOS.objectEnd();
856 ScopeHistory.pop_back();
857 }
858};
859
863
866 }
867
869 this->W = &W;
870 W.objectBegin();
871 }
872
874 if (W)
875 W->objectEnd();
876 }
877};
878
882
885 }
886
888 this->W = &W;
889 W.arrayBegin();
890 }
891
893 if (W)
894 W->arrayEnd();
895 }
896};
897
898}
899
900#endif
This file implements the APSInt class, which is a simple class that represents an arbitrary sized int...
static constexpr std::size_t number(BlockVerifier::State S)
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
dxil pretty DXIL Metadata Pretty Printer
This file supports working with JSON data.
This file contains library features backported from future STL versions.
This file defines the SmallVector class.
An arbitrary precision integer that knows its signedness.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
void printNumber(StringRef Label, signed char Value) override
Definition ScopedPrinter.h:600
void printNumber(StringRef Label, double Value) override
Definition ScopedPrinter.h:644
void printList(StringRef Label, const ArrayRef< std::string > List) override
Definition ScopedPrinter.h:662
void printNumber(StringRef Label, float Value) override
Definition ScopedPrinter.h:640
void printNumber(StringRef Label, short Value) override
Definition ScopedPrinter.h:608
void printNumber(StringRef Label, long long Value) override
Definition ScopedPrinter.h:632
void printList(StringRef Label, const ArrayRef< uint8_t > List) override
Definition ScopedPrinter.h:678
void printList(StringRef Label, const ArrayRef< int32_t > List) override
Definition ScopedPrinter.h:686
void printNumber(StringRef Label, char Value) override
Definition ScopedPrinter.h:596
void printBoolean(StringRef Label, bool Value) override
Definition ScopedPrinter.h:654
void printNumber(StringRef Label, unsigned char Value) override
Definition ScopedPrinter.h:604
void printList(StringRef Label, const ArrayRef< int64_t > List) override
Definition ScopedPrinter.h:682
void printNumber(StringRef Label, int Value) override
Definition ScopedPrinter.h:616
LLVM_ABI JSONScopedPrinter(raw_ostream &OS, bool PrettyPrint=false, std::unique_ptr< DelimitedScope > &&OuterScope=std::unique_ptr< DelimitedScope >{})
void printList(StringRef Label, const ArrayRef< bool > List) override
Definition ScopedPrinter.h:658
void arrayBegin() override
Definition ScopedPrinter.h:722
void printList(StringRef Label, const ArrayRef< APSInt > List) override
Definition ScopedPrinter.h:698
void printList(StringRef Label, const ArrayRef< uint64_t > List) override
Definition ScopedPrinter.h:666
void printList(StringRef Label, const ArrayRef< uint16_t > List) override
Definition ScopedPrinter.h:674
void printNumber(StringRef Label, long Value) override
Definition ScopedPrinter.h:624
void printList(StringRef Label, const ArrayRef< int16_t > List) override
Definition ScopedPrinter.h:690
void objectEnd() override
Definition ScopedPrinter.h:720
static bool classof(const ScopedPrinter *SP)
Definition ScopedPrinter.h:592
void printNumber(StringRef Label, const APSInt &Value) override
Definition ScopedPrinter.h:648
void printList(StringRef Label, const ArrayRef< uint32_t > List) override
Definition ScopedPrinter.h:670
void printNumber(StringRef Label, unsigned int Value) override
Definition ScopedPrinter.h:620
void arrayBegin(StringRef Label) override
Definition ScopedPrinter.h:726
void arrayEnd() override
Definition ScopedPrinter.h:730
void printString(StringRef Value) override
Definition ScopedPrinter.h:706
void printNumber(StringRef Label, unsigned short Value) override
Definition ScopedPrinter.h:612
void objectBegin(StringRef Label) override
Definition ScopedPrinter.h:716
void printNumber(StringRef Label, unsigned long Value) override
Definition ScopedPrinter.h:628
void printString(StringRef Label, StringRef Value) override
Definition ScopedPrinter.h:708
void printList(StringRef Label, const ArrayRef< int8_t > List) override
Definition ScopedPrinter.h:694
void printNumber(StringRef Label, unsigned long long Value) override
Definition ScopedPrinter.h:636
void objectBegin() override
Definition ScopedPrinter.h:712
A helper class to return the specified delimiter string after the first invocation of operator String...
Definition ScopedPrinter.h:121
virtual void printList(StringRef Label, const ArrayRef< int32_t > List)
Definition ScopedPrinter.h:334
void printHexList(StringRef Label, const T &List)
Definition ScopedPrinter.h:364
void flush()
Definition ScopedPrinter.h:140
virtual void printList(StringRef Label, const ArrayRef< uint32_t > List)
Definition ScopedPrinter.h:315
void printBinary(StringRef Label, StringRef Str, ArrayRef< char > Value)
Definition ScopedPrinter.h:398
virtual void printString(StringRef Value)
Definition ScopedPrinter.h:384
void printBinaryBlock(StringRef Label, ArrayRef< uint8_t > Value, uint32_t StartOffset)
Definition ScopedPrinter.h:420
void printStringEscaped(StringRef Label, StringRef Value)
Definition ScopedPrinter.h:390
void printBinaryBlock(StringRef Label, StringRef Value)
Definition ScopedPrinter.h:429
virtual void printNumber(StringRef Label, unsigned short Value)
Definition ScopedPrinter.h:238
int getIndentLevel()
Definition ScopedPrinter.h:150
virtual void printNumber(StringRef Label, long Value)
Definition ScopedPrinter.h:250
virtual void arrayEnd()
Definition ScopedPrinter.h:449
virtual void printList(StringRef Label, const ArrayRef< int64_t > List)
Definition ScopedPrinter.h:330
virtual void printNumber(StringRef Label, unsigned int Value)
Definition ScopedPrinter.h:246
void indent(int Levels=1)
Definition ScopedPrinter.h:142
virtual void printList(StringRef Label, const ArrayRef< int16_t > List)
Definition ScopedPrinter.h:338
virtual void printNumber(StringRef Label, long long Value)
Definition ScopedPrinter.h:258
void printFlags(StringRef Label, T Value)
Definition ScopedPrinter.h:209
virtual void printList(StringRef Label, const ArrayRef< std::string > List)
Definition ScopedPrinter.h:307
void resetIndent()
Definition ScopedPrinter.h:148
void unindent(int Levels=1)
Definition ScopedPrinter.h:144
void printBinaryBlock(StringRef Label, ArrayRef< uint8_t > Value)
Definition ScopedPrinter.h:425
virtual void arrayBegin(StringRef Label)
Definition ScopedPrinter.h:447
void printEnum(StringRef Label, T Value, ArrayRef< EnumEntry< TEnum > > EnumValues)
Definition ScopedPrinter.h:163
virtual void printList(StringRef Label, const ArrayRef< bool > List)
Definition ScopedPrinter.h:303
virtual void printList(StringRef Label, const ArrayRef< APSInt > List)
Definition ScopedPrinter.h:349
ScopedPrinterKind getKind() const
Definition ScopedPrinter.h:132
virtual void printNumber(StringRef Label, const APSInt &Value)
Definition ScopedPrinter.h:266
ScopedPrinter(raw_ostream &OS, ScopedPrinterKind Kind=ScopedPrinterKind::Base)
Definition ScopedPrinter.h:128
HexNumber hex(T Value)
Definition ScopedPrinter.h:160
void printList(StringRef Label, const T &List, const U &Printer)
Definition ScopedPrinter.h:354
virtual void printNumber(StringRef Label, short Value)
Definition ScopedPrinter.h:234
void printBinary(StringRef Label, StringRef Value)
Definition ScopedPrinter.h:414
virtual raw_ostream & getOStream()
Definition ScopedPrinter.h:456
ScopedPrinterKind
Definition ScopedPrinter.h:123
@ Base
Definition ScopedPrinter.h:124
@ JSON
Definition ScopedPrinter.h:125
virtual void printList(StringRef Label, const ArrayRef< int8_t > List)
Definition ScopedPrinter.h:342
static bool classof(const ScopedPrinter *SP)
Definition ScopedPrinter.h:134
virtual void printNumber(StringRef Label, unsigned long Value)
Definition ScopedPrinter.h:254
virtual raw_ostream & startLine()
Definition ScopedPrinter.h:451
virtual void printNumber(StringRef Label, char Value)
Definition ScopedPrinter.h:222
virtual void printNumber(StringRef Label, int Value)
Definition ScopedPrinter.h:242
void printBinary(StringRef Label, StringRef Str, ArrayRef< uint8_t > Value)
Definition ScopedPrinter.h:394
virtual void printList(StringRef Label, const ArrayRef< uint64_t > List)
Definition ScopedPrinter.h:311
virtual void printNumber(StringRef Label, float Value)
Definition ScopedPrinter.h:270
void printHex(StringRef Label, T Value)
Definition ScopedPrinter.h:371
virtual void objectBegin(StringRef Label)
Definition ScopedPrinter.h:441
void setPrefix(StringRef P)
Definition ScopedPrinter.h:152
virtual void objectEnd()
Definition ScopedPrinter.h:443
void printFlags(StringRef Label, T Value, ArrayRef< EnumEntry< TFlag > > Flags, TFlag EnumMask1={}, TFlag EnumMask2={}, TFlag EnumMask3={}, ArrayRef< FlagEntry > ExtraFlags={})
Definition ScopedPrinter.h:182
void printVersion(StringRef Label, T MajorVersion, TArgs... MinorVersions)
Definition ScopedPrinter.h:288
virtual ~ScopedPrinter()=default
virtual void arrayBegin()
Definition ScopedPrinter.h:445
virtual void printBoolean(StringRef Label, bool Value)
Definition ScopedPrinter.h:283
void printHex(StringRef Label, StringRef Str, T Value)
Definition ScopedPrinter.h:375
void printNumber(StringRef Label, StringRef Str, T Value)
Definition ScopedPrinter.h:279
virtual void objectBegin()
Definition ScopedPrinter.h:439
virtual void printNumber(StringRef Label, signed char Value)
Definition ScopedPrinter.h:226
virtual void printNumber(StringRef Label, unsigned char Value)
Definition ScopedPrinter.h:230
virtual void printNumber(StringRef Label, unsigned long long Value)
Definition ScopedPrinter.h:262
void printIndent()
Definition ScopedPrinter.h:154
virtual void printList(StringRef Label, const ArrayRef< uint16_t > List)
Definition ScopedPrinter.h:319
virtual void printString(StringRef Label, StringRef Value)
Definition ScopedPrinter.h:386
virtual void printList(StringRef Label, const ArrayRef< uint8_t > List)
Definition ScopedPrinter.h:323
void printSymbolOffset(StringRef Label, StringRef Symbol, T Value)
Definition ScopedPrinter.h:380
virtual void printNumber(StringRef Label, double Value)
Definition ScopedPrinter.h:274
void printBinary(StringRef Label, ArrayRef< char > Value)
Definition ScopedPrinter.h:408
void printList(StringRef Label, const ArrayRef< T > List)
Definition ScopedPrinter.h:296
void printBinary(StringRef Label, ArrayRef< uint8_t > Value)
Definition ScopedPrinter.h:404
void printObject(StringRef Label, const T &Value)
Definition ScopedPrinter.h:435
reference emplace_back(ArgTypes &&... Args)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
LLVM Value Representation.
json::OStream allows writing well-formed JSON without materializing all structures as json::Value ahe...
LLVM_ABI raw_ostream & rawValueBegin()
LLVM_ABI void rawValueEnd()
This class implements an extremely fast bulk output stream that can only output to a stream.
A raw_ostream that writes to an std::string.
Flag
These should be considered private to the implementation of the MCInstrDesc class.
detail::packed_endian_specific_integral< uint16_t, llvm::endianness::little, unaligned > ulittle16_t
This is an optimization pass for GlobalISel generic memory operations.
FunctionAddr VTableAddr Value
std::string utohexstr(uint64_t X, bool LowerCase=false, unsigned Width=0)
std::string enumToString(T Value, ArrayRef< EnumEntry< TEnum > > EnumValues)
Definition ScopedPrinter.h:103
void sort(IteratorTy Start, IteratorTy End)
constexpr std::underlying_type_t< Enum > to_underlying(Enum E)
Returns underlying integer value of an enum.
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
const char * to_string(ThinOrFullLTOPhase Phase)
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
ArrayRef(const T &OneElt) -> ArrayRef< T >
StringRef enumToStringRef(T Value, ArrayRef< EnumEntry< TEnum > > EnumValues)
Retrieves the Value's enum name.
Definition ScopedPrinter.h:114
virtual void setPrinter(ScopedPrinter &W)=0
DelimitedScope(ScopedPrinter &W)
Definition ScopedPrinter.h:556
ScopedPrinter * W
Definition ScopedPrinter.h:560
virtual ~DelimitedScope()=default
DelimitedScope()
Definition ScopedPrinter.h:557
~DictScope() override
Definition ScopedPrinter.h:873
DictScope(ScopedPrinter &W)
Definition ScopedPrinter.h:862
DictScope(ScopedPrinter &W, StringRef N)
Definition ScopedPrinter.h:864
void setPrinter(ScopedPrinter &W) override
Definition ScopedPrinter.h:868
Definition ScopedPrinter.h:27
constexpr EnumEntry(StringRef N, StringRef A, T V)
Definition ScopedPrinter.h:38
StringRef AltName
Definition ScopedPrinter.h:36
StringRef Name
Definition ScopedPrinter.h:28
T Value
Definition ScopedPrinter.h:37
constexpr EnumEntry(StringRef N, T V)
Definition ScopedPrinter.h:40
Definition ScopedPrinter.h:66
FlagEntry(StringRef Name, signed long Value)
Definition ScopedPrinter.h:75
FlagEntry(StringRef Name, signed int Value)
Definition ScopedPrinter.h:73
FlagEntry(StringRef Name, unsigned short Value)
Definition ScopedPrinter.h:80
FlagEntry(StringRef Name, unsigned long long Value)
Definition ScopedPrinter.h:83
FlagEntry(StringRef Name, unsigned long Value)
Definition ScopedPrinter.h:82
FlagEntry(StringRef Name, signed long long Value)
Definition ScopedPrinter.h:77
FlagEntry(StringRef Name, char Value)
Definition ScopedPrinter.h:67
uint64_t Value
Definition ScopedPrinter.h:90
FlagEntry(StringRef Name, signed char Value)
Definition ScopedPrinter.h:69
FlagEntry(StringRef Name, signed short Value)
Definition ScopedPrinter.h:71
FlagEntry(StringRef Name, EnumT Value)
Definition ScopedPrinter.h:86
FlagEntry(StringRef Name, unsigned int Value)
Definition ScopedPrinter.h:81
FlagEntry(StringRef Name, unsigned char Value)
Definition ScopedPrinter.h:79
StringRef Name
Definition ScopedPrinter.h:89
Definition ScopedPrinter.h:43
HexNumber(unsigned char Value)
Definition ScopedPrinter.h:55
HexNumber(signed int Value)
Definition ScopedPrinter.h:51
HexNumber(signed long long Value)
Definition ScopedPrinter.h:53
HexNumber(char Value)
Definition ScopedPrinter.h:48
uint64_t Value
Definition ScopedPrinter.h:63
HexNumber(signed long Value)
Definition ScopedPrinter.h:52
HexNumber(unsigned int Value)
Definition ScopedPrinter.h:57
HexNumber(unsigned long long Value)
Definition ScopedPrinter.h:59
HexNumber(signed char Value)
Definition ScopedPrinter.h:49
HexNumber(signed short Value)
Definition ScopedPrinter.h:50
HexNumber(unsigned long Value)
Definition ScopedPrinter.h:58
HexNumber(unsigned short Value)
Definition ScopedPrinter.h:56
HexNumber(EnumT Value)
Definition ScopedPrinter.h:61
ListScope(ScopedPrinter &W)
Definition ScopedPrinter.h:881
~ListScope() override
Definition ScopedPrinter.h:892
void setPrinter(ScopedPrinter &W) override
Definition ScopedPrinter.h:887
ListScope(ScopedPrinter &W, StringRef N)
Definition ScopedPrinter.h:883