LLVM: include/llvm/Testing/Annotations/Annotations.h Source File (original) (raw)
1
2
3
4
5
6
7
8#ifndef LLVM_TESTING_SUPPORT_ANNOTATIONS_H
9#define LLVM_TESTING_SUPPORT_ANNOTATIONS_H
10
14#include
15#include
16
17namespace llvm {
18
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
54public:
55
56
60
62 return std::tie(L.Begin, L.End) == std::tie(R.Begin, R.End);
63 }
65 };
66
67
69
70
71
73
74
75
77
78 std::pair<size_t, llvm::StringRef>
80
81
83
84 std::vector<std::pair<size_t, llvm::StringRef>>
86
87
88
89
91
92
93
95
96
97 std::pair<Range, llvm::StringRef>
99
100
102
103
104
105 std::vector<std::pair<Range, llvm::StringRef>>
107
108
109
111
112private:
113 std::string Code;
114
115 struct Annotation {
116 size_t Begin;
117 size_t End = -1;
118 bool isPoint() const { return End == size_t(-1); }
121 };
122 std::vector All;
123
124 llvm::StringMap<llvm::SmallVector<size_t, 1>> Points;
125 llvm::StringMap<llvm::SmallVector<size_t, 1>> Ranges;
126};
127
130
131}
132
133#endif
This file defines the StringMap class.
ConstantRange Range(APInt(BitWidth, Low), APInt(BitWidth, High))
This file defines the SmallVector class.
Annotations(llvm::StringRef Text)
Parses the annotations from Text. Crashes if it's malformed.
std::vector< std::pair< size_t, llvm::StringRef > > pointsWithPayload(llvm::StringRef Name="") const
Returns the positions and payloads (if any) of all points named Name.
Range range(llvm::StringRef Name="") const
Returns the location of the range marked by [[ ]] (or $name[[ ]]).
size_t point(llvm::StringRef Name="") const
Returns the position of the point marked by ^ (or $name^) in the text.
std::pair< size_t, llvm::StringRef > pointWithPayload(llvm::StringRef Name="") const
Returns the position of the point with Name and its payload (if any).
llvm::StringMap< llvm::SmallVector< size_t, 1 > > all_points() const
Returns the mapping of all names of points marked in the text to their position.
std::pair< Range, llvm::StringRef > rangeWithPayload(llvm::StringRef Name="") const
Returns the location and payload of the range marked by [[ ]] (or $name(payload)[[ ]]).
std::vector< Range > ranges(llvm::StringRef Name="") const
Returns the location of all ranges marked by [[ ]] (or $name[[ ]]).
std::vector< std::pair< Range, llvm::StringRef > > rangesWithPayload(llvm::StringRef Name="") const
Returns the location of all ranges marked by [[ ]] (or $name(payload)[[ ]]).
llvm::StringMap< llvm::SmallVector< Range, 1 > > all_ranges() const
Returns the mapping of all names of ranges marked in the text to their location.
std::vector< size_t > points(llvm::StringRef Name="") const
Returns the position of all points marked by ^ (or $name^) in the text.
llvm::StringRef code() const
The input text with all annotations stripped.
Definition Annotations.h:72
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
StringRef - Represent a constant reference to a string, i.e.
This class implements an extremely fast bulk output stream that can only output to a stream.
This is an optimization pass for GlobalISel generic memory operations.
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
Two offsets pointing to a continuous substring.
Definition Annotations.h:57
friend bool operator==(const Range &L, const Range &R)
Definition Annotations.h:61
friend bool operator!=(const Range &L, const Range &R)
Definition Annotations.h:64
size_t End
Definition Annotations.h:59
size_t Begin
Definition Annotations.h:58