Skip to content

Commit d5f61d0

Browse files
committed
checkstl.cpp: cleaned up LoopAnalyzer access
1 parent 5d379b1 commit d5f61d0

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

lib/checkstl.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2867,11 +2867,13 @@ static bool isTernaryAssignment(const Token* assignTok, nonneg int loopVarId, no
28672867

28682868
namespace {
28692869
struct LoopAnalyzer {
2870-
const Token* bodyTok = nullptr;
2871-
const Token* loopVar = nullptr;
2870+
private:
2871+
const Token* bodyTok;
2872+
const Token* loopVar{};
28722873
const Settings& settings;
28732874
std::set<nonneg int> varsChanged;
28742875

2876+
public:
28752877
explicit LoopAnalyzer(const Token* tok, const Settings& psettings)
28762878
: bodyTok(tok->linkAt(1)->next()), settings(psettings)
28772879
{
@@ -2883,6 +2885,7 @@ namespace {
28832885
findChangedVariables();
28842886
}
28852887
}
2888+
private:
28862889
bool isLoopVarChanged() const {
28872890
return varsChanged.count(loopVar->varId()) > 0;
28882891
}
@@ -2934,6 +2937,7 @@ namespace {
29342937
return bodyTok && loopVar;
29352938
}
29362939

2940+
public:
29372941
std::string findAlgo() const
29382942
{
29392943
if (!valid())
@@ -2965,7 +2969,7 @@ namespace {
29652969
}
29662970
return "";
29672971
}
2968-
2972+
private:
29692973
bool isLocalVar(const Variable* var) const
29702974
{
29712975
if (!var)
@@ -2978,7 +2982,6 @@ namespace {
29782982
return scope && scope->isNestedIn(bodyTok->scope());
29792983
}
29802984

2981-
private:
29822985
void findChangedVariables()
29832986
{
29842987
std::set<nonneg int> vars;

0 commit comments

Comments
 (0)