Initialize class variables at construction time.

Calling `visitProgramElement` on a FunctionDefinition should always set
fFunctionSize on any path through the code. However, this is difficult
to confirm by inspection, since there are several exit conditions. It's
safest to initialize the variables at construction time, just in case.

Change-Id: I8bfda5fc5c4d71f5593ea2469586d668be762449
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/445636
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This commit is contained in:
John Stiles 2021-09-03 10:45:26 -04:00
parent e780d6bb45
commit b6c29c7b22

View File

@ -765,8 +765,8 @@ bool Analysis::CheckProgramUnrolledSize(const Program& program) {
using INHERITED = ProgramVisitor;
[[maybe_unused]] const Context& fContext;
int fFunctionSize;
int fUnrollFactor;
int fFunctionSize = 0;
int fUnrollFactor = 1;
std::unordered_map<const FunctionDeclaration*, int> fFunctionCostMap;
std::vector<const FunctionDeclaration*> fStack;
};