@@ -170,16 +170,17 @@ class ASTWalker {
170170 // The 'Result' set of types, which do take a payload.
171171 template <typename T>
172172 struct ContinueWalkResult {
173+ ContinueWalkAction Action;
173174 T Value;
174175 };
175176 template <typename T>
176177 struct SkipChildrenIfWalkResult {
177- bool Cond ;
178+ SkipChildrenIfWalkAction Action ;
178179 T Value;
179180 };
180181 template <typename T>
181182 struct StopIfWalkResult {
182- bool Cond ;
183+ StopIfWalkAction Action ;
183184 T Value;
184185 };
185186 };
@@ -212,7 +213,7 @@ class ASTWalker {
212213 // / Continue the current walk, replacing the current node with \p node.
213214 template <typename T>
214215 static _Detail::ContinueWalkResult<T> Continue (T node) {
215- return {std::move (node)};
216+ return {Continue (), std::move (node)};
216217 }
217218
218219 // / Continue the current walk, replacing the current node with \p node.
@@ -228,7 +229,7 @@ class ASTWalker {
228229 template <typename T>
229230 static _Detail::SkipChildrenIfWalkResult<T>
230231 SkipChildrenIf (bool cond, T node) {
231- return {cond, std::move (node)};
232+ return {SkipChildrenIf ( cond) , std::move (node)};
232233 }
233234
234235 // / If \p cond is true, this is equivalent to \c Action::Continue(node).
@@ -243,7 +244,7 @@ class ASTWalker {
243244 // / Otherwise, it is equivalent to \c Action::Continue(node).
244245 template <typename T>
245246 static _Detail::StopIfWalkResult<T> StopIf (bool cond, T node) {
246- return {cond, std::move (node)};
247+ return {StopIf ( cond) , std::move (node)};
247248 }
248249
249250 // / Continue the current walk.
@@ -283,8 +284,6 @@ class ASTWalker {
283284 enum Kind { Stop, SkipChildren, Continue };
284285 Kind Action;
285286
286- PreWalkAction (Kind action) : Action(action) {}
287-
288287 PreWalkAction (_Detail::ContinueWalkAction) : Action(Continue) {}
289288 PreWalkAction (_Detail::StopWalkAction) : Action(Stop) {}
290289
@@ -303,8 +302,6 @@ class ASTWalker {
303302 enum Kind { Stop, Continue };
304303 Kind Action;
305304
306- PostWalkAction (Kind action) : Action(action) {}
307-
308305 PostWalkAction (_Detail::ContinueWalkAction) : Action(Continue) {}
309306 PostWalkAction (_Detail::StopWalkAction) : Action(Stop) {}
310307
@@ -340,21 +337,18 @@ class ASTWalker {
340337
341338 template <typename U>
342339 PreWalkResult (_Detail::ContinueWalkResult<U> Result)
343- : Action(PreWalkAction::Continue ), Value(std::move(Result.Value)) {}
340+ : Action(Result.Action ), Value(std::move(Result.Value)) {}
344341
345342 template <typename U>
346343 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)) {}
350345
351346 template <typename U>
352347 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)) {}
355349
356- PreWalkResult (_Detail::StopWalkAction)
357- : Action(PreWalkAction::Stop ), Value(llvm::None) {}
350+ PreWalkResult (_Detail::StopWalkAction Action )
351+ : Action(Action ), Value(llvm::None) {}
358352 };
359353
360354 // / Do not construct directly, use \c Action::<action> instead.
@@ -385,15 +379,14 @@ class ASTWalker {
385379
386380 template <typename U>
387381 PostWalkResult (_Detail::ContinueWalkResult<U> Result)
388- : Action(PostWalkAction::Continue ), Value(std::move(Result.Value)) {}
382+ : Action(Result.Action ), Value(std::move(Result.Value)) {}
389383
390384 template <typename U>
391385 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)) {}
394387
395- PostWalkResult (_Detail::StopWalkAction)
396- : Action(PostWalkAction::Stop ), Value(llvm::None) {}
388+ PostWalkResult (_Detail::StopWalkAction Action )
389+ : Action(Action ), Value(llvm::None) {}
397390 };
398391
399392 // / This method is called when first visiting an expression
0 commit comments