From e2e2a7decd45f1011cb1ebe703f075d5e09834b9 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Wed, 18 Nov 2020 08:18:07 -0800 Subject: [effects.h] Make internals internal, forcing the external API to be safe. (#3385) A user of EffectAnalyzer could call walk or visit, to walk the entire input or just visit the node without chlidren. But this was unsafe - we just exposed the Walker/Visitor API here, and did not ensure that users did the stuff in analyze which does a little stuff before and after. In fact Vacuum got this wrong. To avoid that, move all the internals to an internal class. The external API now only allows the caller to call walk or visit, and both are safe. The change here is mostly whitespace + adding parent. prefixes. This is NFC except for fixing possible Vacuum issues (which I am not sure could happen in practice or not). --- src/passes/CodePushing.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/passes/CodePushing.cpp') diff --git a/src/passes/CodePushing.cpp b/src/passes/CodePushing.cpp index 7af192838..55c955539 100644 --- a/src/passes/CodePushing.cpp +++ b/src/passes/CodePushing.cpp @@ -160,7 +160,7 @@ private: firstPushable < pushPoint); // everything that matters if you want to be pushed past the pushPoint EffectAnalyzer cumulativeEffects(passOptions, features); - cumulativeEffects.analyze(list[pushPoint]); + cumulativeEffects.walk(list[pushPoint]); // it is ok to ignore the branching here, that is the crucial point of this // opt // TODO: it would be ok to ignore thrown exceptions here, if we know they @@ -194,7 +194,7 @@ private: } } else { // something that can't be pushed, so it might block further pushing - cumulativeEffects.analyze(list[i]); + cumulativeEffects.walk(list[i]); } assert(i > 0); i--; -- cgit v1.2.3