You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"Using an operator like '" + operatorString + "' in a case label is suspicious. Did you intend to use a bitwise operator, multiple case labels or if/else instead?", CWE398, Certainty::inconclusive);
852
852
}
853
853
854
+
staticboolisNestedInSwitch(const Scope* scope)
855
+
{
856
+
while (scope) {
857
+
if (scope->type == Scope::ScopeType::eSwitch)
858
+
returntrue;
859
+
if (scope->type == Scope::ScopeType::eUnconditional) {
860
+
scope = scope->nestedIn;
861
+
continue;
862
+
}
863
+
break;
864
+
}
865
+
returnfalse;
866
+
}
867
+
868
+
staticboolisVardeclInSwitch(const Token* tok)
869
+
{
870
+
if (!tok)
871
+
returnfalse;
872
+
if (!isNestedInSwitch(tok->scope()))
873
+
returnfalse;
874
+
const Token* end = Token::findsimplematch(tok, ";");
875
+
return end && end->previous()->variable() && end->previous()->variable()->nameToken() == end->previous();
0 commit comments