clang: include/clang/Tooling/Transformer/Stencil.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20#ifndef LLVM_CLANG_TOOLING_TRANSFORMER_STENCIL_H_
21#define LLVM_CLANG_TOOLING_TRANSFORMER_STENCIL_H_
22
28#include "llvm/ADT/StringRef.h"
29#include "llvm/Support/Error.h"
30#include
31#include
32
34namespace transformer {
35
37
38
39
40
41
42
43
44
45
46using Stencil = std::shared_ptr;
47
48namespace detail {
49
50
51
52
56}
57
58
59
61
62
63
64template <typename... Ts> Stencil cat(Ts &&... Parts) {
66}
67
68
69
70
71
72
73
74
75
77
78
79
81
82
83
84
86
87
88
89
91
92
93
94
95
97
98
99
100
101
102
106}
107
108
109
111
112
113
115 llvm::StringRef FalseText) {
118}
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149Stencil selectBound(std::vector<std::pair<std::string, Stencil>> CaseStencils,
150 Stencil DefaultStencil = nullptr);
151
152
153
154Stencil run(MatchConsumerstd::string C);
155
156
157
158
159
160
161
162
164
165
166
167
169}
170}
171#endif
Defines the clang::ASTContext interface.
Defines a combinator library supporting the definition of selectors, which select source ranges based...
Smart pointer class that efficiently represents Objective-C method names.
A failable computation over nodes bound by AST matchers, with (limited) reflection via the toString m...
Stencil makeStencil(llvm::StringRef Text)
Convenience function to construct a Stencil.
Stencil addressOf(llvm::StringRef ExprId)
Constructs an expression that idiomatically takes the address of the expression bound to ExprId.
Stencil maybeAddressOf(llvm::StringRef ExprId)
If ExprId is not a pointer type, constructs an expression that idiomatically takes the address of the...
Stencil maybeDeref(llvm::StringRef ExprId)
If ExprId is of pointer type, constructs an idiomatic dereferencing of the expression bound to ExprId...
Stencil describe(llvm::StringRef Id)
Produces a human-readable rendering of the node bound to Id, suitable for diagnostics and debugging.
Stencil access(llvm::StringRef BaseId, Stencil Member)
Constructs a MemberExpr that accesses the named member (Member) of the object bound to BaseId.
MatchConsumer< T > ifBound(std::string ID, MatchConsumer< T > TrueC, MatchConsumer< T > FalseC)
Chooses between the two consumers, based on whether ID is bound in the match.
Stencil deref(llvm::StringRef ExprId)
Constructs an idiomatic dereferencing of the expression bound to ExprId.
MatchConsumer< CharSourceRange > RangeSelector
std::shared_ptr< StencilInterface > Stencil
A sequence of code fragments, references to parameters and code-generation operations that together c...
Stencil run(MatchConsumer< std::string > C)
Wraps a MatchConsumer in a Stencil, so that it can be used in a Stencil.
Stencil expression(llvm::StringRef Id)
Generates the source of the expression bound to Id, wrapping it in parentheses if it may parse differ...
Stencil dPrint(llvm::StringRef Id)
For debug use only; semantics are not guaranteed.
Stencil cat(Ts &&... Parts)
Concatenates 0+ stencil pieces into a single stencil.
Stencil selectBound(std::vector< std::pair< std::string, Stencil > > CaseStencils, Stencil DefaultStencil=nullptr)
Chooses between multiple stencils, based on the presence of bound nodes.
Stencil catVector(std::vector< Stencil > Parts)
Constructs the string representing the concatenation of the given Parts.
The JSON file list parser is used to communicate input to InstallAPI.