@@ -170,16 +170,17 @@ class ASTWalker {
170
170
// The 'Result' set of types, which do take a payload.
171
171
template <typename T>
172
172
struct ContinueWalkResult {
173
+ ContinueWalkAction Action;
173
174
T Value;
174
175
};
175
176
template <typename T>
176
177
struct SkipChildrenIfWalkResult {
177
- bool Cond ;
178
+ SkipChildrenIfWalkAction Action ;
178
179
T Value;
179
180
};
180
181
template <typename T>
181
182
struct StopIfWalkResult {
182
- bool Cond ;
183
+ StopIfWalkAction Action ;
183
184
T Value;
184
185
};
185
186
};
@@ -212,7 +213,7 @@ class ASTWalker {
212
213
// / Continue the current walk, replacing the current node with \p node.
213
214
template <typename T>
214
215
static _Detail::ContinueWalkResult<T> Continue (T node) {
215
- return {std::move (node)};
216
+ return {Continue (), std::move (node)};
216
217
}
217
218
218
219
// / Continue the current walk, replacing the current node with \p node.
@@ -228,7 +229,7 @@ class ASTWalker {
228
229
template <typename T>
229
230
static _Detail::SkipChildrenIfWalkResult<T>
230
231
SkipChildrenIf (bool cond, T node) {
231
- return {cond, std::move (node)};
232
+ return {SkipChildrenIf ( cond) , std::move (node)};
232
233
}
233
234
234
235
// / If \p cond is true, this is equivalent to \c Action::Continue(node).
@@ -243,7 +244,7 @@ class ASTWalker {
243
244
// / Otherwise, it is equivalent to \c Action::Continue(node).
244
245
template <typename T>
245
246
static _Detail::StopIfWalkResult<T> StopIf (bool cond, T node) {
246
- return {cond, std::move (node)};
247
+ return {StopIf ( cond) , std::move (node)};
247
248
}
248
249
249
250
// / Continue the current walk.
@@ -283,8 +284,6 @@ class ASTWalker {
283
284
enum Kind { Stop, SkipChildren, Continue };
284
285
Kind Action;
285
286
286
- PreWalkAction (Kind action) : Action(action) {}
287
-
288
287
PreWalkAction (_Detail::ContinueWalkAction) : Action(Continue) {}
289
288
PreWalkAction (_Detail::StopWalkAction) : Action(Stop) {}
290
289
@@ -303,8 +302,6 @@ class ASTWalker {
303
302
enum Kind { Stop, Continue };
304
303
Kind Action;
305
304
306
- PostWalkAction (Kind action) : Action(action) {}
307
-
308
305
PostWalkAction (_Detail::ContinueWalkAction) : Action(Continue) {}
309
306
PostWalkAction (_Detail::StopWalkAction) : Action(Stop) {}
310
307
@@ -340,21 +337,18 @@ class ASTWalker {
340
337
341
338
template <typename U>
342
339
PreWalkResult (_Detail::ContinueWalkResult<U> Result)
343
- : Action(PreWalkAction::Continue ), Value(std::move(Result.Value)) {}
340
+ : Action(Result.Action ), Value(std::move(Result.Value)) {}
344
341
345
342
template <typename U>
346
343
PreWalkResult (_Detail::SkipChildrenIfWalkResult<U> Result)
347
- : Action(Result.Cond ? PreWalkAction::SkipChildren
348
- : PreWalkAction::Continue),
349
- Value (std::move(Result.Value)) {}
344
+ : Action(Result.Action), Value(std::move(Result.Value)) {}
350
345
351
346
template <typename U>
352
347
PreWalkResult (_Detail::StopIfWalkResult<U> Result)
353
- : Action(Result.Cond ? PreWalkAction::Stop : PreWalkAction::Continue),
354
- Value(std::move(Result.Value)) {}
348
+ : Action(Result.Action), Value(std::move(Result.Value)) {}
355
349
356
- PreWalkResult (_Detail::StopWalkAction)
357
- : Action(PreWalkAction::Stop ), Value(llvm::None) {}
350
+ PreWalkResult (_Detail::StopWalkAction Action )
351
+ : Action(Action ), Value(llvm::None) {}
358
352
};
359
353
360
354
// / Do not construct directly, use \c Action::<action> instead.
@@ -385,15 +379,14 @@ class ASTWalker {
385
379
386
380
template <typename U>
387
381
PostWalkResult (_Detail::ContinueWalkResult<U> Result)
388
- : Action(PostWalkAction::Continue ), Value(std::move(Result.Value)) {}
382
+ : Action(Result.Action ), Value(std::move(Result.Value)) {}
389
383
390
384
template <typename U>
391
385
PostWalkResult (_Detail::StopIfWalkResult<U> Result)
392
- : Action(Result.Cond ? PostWalkAction::Stop : PostWalkAction::Continue),
393
- Value (std::move(Result.Value)) {}
386
+ : Action(Result.Action), Value(std::move(Result.Value)) {}
394
387
395
- PostWalkResult (_Detail::StopWalkAction)
396
- : Action(PostWalkAction::Stop ), Value(llvm::None) {}
388
+ PostWalkResult (_Detail::StopWalkAction Action )
389
+ : Action(Action ), Value(llvm::None) {}
397
390
};
398
391
399
392
// / This method is called when first visiting an expression
0 commit comments