diff --git a/lib/astutils.cpp b/lib/astutils.cpp index cddf070d0..f1d52ba7e 100644 --- a/lib/astutils.cpp +++ b/lib/astutils.cpp @@ -1423,7 +1423,9 @@ bool isConstVarExpression(const Token *tok, const char* skipMatch) if (Token::simpleMatch(tok->astOperand1(), ".") && !isConstVarExpression(tok->astOperand1(), skipMatch)) return false; std::vector args = getArguments(tok); - return std::all_of(args.begin(), args.end(), [&](const Token* t) { return isConstVarExpression(t, skipMatch); }); + return std::all_of(args.begin(), args.end(), [&](const Token* t) { + return isConstVarExpression(t, skipMatch); + }); } if (isCPPCast(tok)) { return isConstVarExpression(tok->astOperand2(), skipMatch); diff --git a/lib/checkclass.cpp b/lib/checkclass.cpp index fd6875e41..5f36595b8 100644 --- a/lib/checkclass.cpp +++ b/lib/checkclass.cpp @@ -2637,8 +2637,8 @@ void CheckClass::checkAccessModifierVirtualFunctions() continue; for (const Function &func : classScope->functionList) { const Function *baseFunc = func.getOverriddenFunction(); - if(baseFunc) { - if(AccessControl::Public == baseFunc->access && AccessControl::Public != func.access) { + if (baseFunc) { + if (AccessControl::Public == baseFunc->access && AccessControl::Public != func.access) { checkAccessModifierVirtualFunctionsError(func.tokenDef, func.name()); } } @@ -2649,10 +2649,10 @@ void CheckClass::checkAccessModifierVirtualFunctions() void CheckClass::checkAccessModifierVirtualFunctionsError(const Token *tok, const std::string& func) { reportError(tok, Severity::style, "hidingInheritedPublic", - "$symbol:" + func + "\n" - "The function '$symbol' has more narrow access modifier in a derived class. It could violate a LSP principle.", - CWE(0U) /* Unknown CWE! */, - false); + "$symbol:" + func + "\n" + "The function '$symbol' has more narrow access modifier in a derived class. It could violate a LSP principle.", + CWE(0U) /* Unknown CWE! */, + false); } void CheckClass::checkUnsafeClassRefMember() diff --git a/test/teststl.cpp b/test/teststl.cpp index f857d1e31..fc35bf46f 100644 --- a/test/teststl.cpp +++ b/test/teststl.cpp @@ -1074,7 +1074,8 @@ private: } void iterator24() - { // #9556 + { + // #9556 check("void f(int a, int b) {\n" " if (&a == &b) {}\n" "}\n");