Cppcheck
|
#include "checkother.h"
#include "astutils.h"
#include "fwdanalysis.h"
#include "library.h"
#include "mathlib.h"
#include "platform.h"
#include "settings.h"
#include "standards.h"
#include "symboldatabase.h"
#include "token.h"
#include "tokenize.h"
#include "tokenlist.h"
#include "utils.h"
#include "valueflow.h"
#include "vfvalue.h"
#include <algorithm>
#include <cctype>
#include <list>
#include <map>
#include <set>
#include <sstream>
#include <utility>
Go to the source code of this file.
Functions | |
static bool | isFunctionOrBreakPattern (const Token *tok) |
static bool | isSimpleExpr (const Token *tok, const Variable *var, const Settings &settings) |
static bool | isVariableMutableInInitializer (const Token *start, const Token *end, nonneg int varid) |
static const Token * | getVariableChangedStart (const Variable *p) |
static bool | isType (const Token *tok, bool unknown) |
static bool | isVarDeclOp (const Token *tok) |
static bool | isBracketAccess (const Token *tok) |
static bool | isConstant (const Token *tok) |
static bool | isConstStatement (const Token *tok, bool isNestedBracket=false) |
static bool | isVoidStmt (const Token *tok) |
static bool | isConstTop (const Token *tok) |
static const Token * | getSingleExpressionInBlock (const Token *tok) |
static bool | constructorTakesReference (const Scope *const classScope) |
static bool | isNegative (const Token *tok, const Settings &settings) |
static const Token * | findShadowed (const Scope *scope, const Variable &var, int linenr) |
static bool | isVariableExpression (const Token *tok) |
static bool | isVariableExprHidden (const Token *tok) |
static bool | getBufAndOffset (const Token *expr, const Token *&buf, MathLib::bigint *offset, const Settings &settings, MathLib::bigint *sizeValue=nullptr) |
Variables | |
static const CWE | CWE128 (128U) |
static const CWE | CWE131 (131U) |
static const CWE | CWE197 (197U) |
static const CWE | CWE362 (362U) |
static const CWE | CWE369 (369U) |
static const CWE | CWE398 (398U) |
static const CWE | CWE475 (475U) |
static const CWE | CWE561 (561U) |
static const CWE | CWE563 (563U) |
static const CWE | CWE570 (570U) |
static const CWE | CWE571 (571U) |
static const CWE | CWE672 (672U) |
static const CWE | CWE628 (628U) |
static const CWE | CWE683 (683U) |
static const CWE | CWE704 (704U) |
static const CWE | CWE758 (758U) |
static const CWE | CWE768 (768U) |
static const CWE | CWE783 (783U) |
|
static |
Definition at line 2825 of file checkother.cpp.
References Scope::functionList.
Referenced by CheckOther::checkRedundantCopy().
Definition at line 3547 of file checkother.cpp.
References Scope::eLambda, Scope::functionList, Scope::functionOf, Scope::isExecutable(), Token::linenr(), Variable::name(), Variable::nameToken(), Scope::nestedIn, Scope::type, and Scope::varlist.
Referenced by CheckOther::checkShadowVariables().
|
static |
Definition at line 3883 of file checkother.cpp.
References Token::astOperand1(), Token::astOperand2(), Token::getKnownIntValue(), ValueFlow::getSizeOf(), Token::hasKnownIntValue(), Token::isBinaryOp(), Token::isUnaryOp(), Token::Match(), ValueType::pointer, Token::simpleMatch(), and Token::valueType().
Referenced by CheckOther::checkOverlappingWrite().
Definition at line 2167 of file checkother.cpp.
References Token::astTop(), nextAfterAstRightmostLeaf(), and Token::simpleMatch().
Referenced by CheckOther::checkDuplicateBranch().
Definition at line 1451 of file checkother.cpp.
References Scope::bodyStart, Variable::isArgument(), Token::isSplittedVarDeclEq(), Variable::nameToken(), Token::next(), Variable::scope(), and Token::tokAt().
Referenced by CheckOther::checkConstPointer().
|
static |
Definition at line 1777 of file checkother.cpp.
References Token::astOperand1(), Token::astOperand2(), Token::simpleMatch(), Token::str(), and Token::variable().
Referenced by isConstStatement().
|
static |
Definition at line 1791 of file checkother.cpp.
References Token::isEnumerator(), and Token::Match().
Referenced by CheckOther::constStatementError(), and isConstStatement().
|
static |
Definition at line 1795 of file checkother.cpp.
References astIsIntegral(), Token::astOperand1(), Token::astOperand2(), Token::astParent(), isBracketAccess(), Token::isCast(), isConstant(), isCPPCast(), Token::isExpandedMacro(), isLikelyStream(), Token::isStandardType(), isVarDeclOp(), isWithoutSideEffects(), Token::Match(), Token::next(), Token::previous(), previousBeforeAstLeftmostLeaf(), Token::simpleMatch(), succeeds(), and Token::varId().
Referenced by CheckOther::checkDuplicateExpression(), CheckOther::checkIncompleteStatement(), and CheckOther::checkMisusedScopedObject().
|
static |
Definition at line 1873 of file checkother.cpp.
References Token::astOperand2(), Token::astParent(), Token::astTop(), Token::Match(), Token::previous(), Token::simpleMatch(), and Token::str().
Referenced by CheckOther::checkIncompleteStatement().
|
inlinestatic |
Definition at line 591 of file checkother.cpp.
References Token::Match().
Referenced by CheckOther::redundantBitwiseOperationInSwitchError().
Definition at line 2918 of file checkother.cpp.
References Token::getValueLE(), ValueType::sign, ValueType::SIGNED, and Token::valueType().
Referenced by CheckOther::checkNegativeBitwiseShift().
|
static |
Definition at line 909 of file checkother.cpp.
References Token::astOperand1(), Token::astOperand2(), Token::astParent(), Scope::bodyEnd, Token::eChar, Token::eString, findExpressionChanged(), Token::function(), Token::isArithmeticalOp(), Token::isBoolean(), Library::isFunctionConst(), isLeafDot(), Token::isNumber(), Settings::library, Token::Match(), Token::previous(), Variable::scope(), Token::str(), Token::tokType(), and Token::varId().
Referenced by CheckOther::checkVariableScope().
|
static |
Definition at line 1751 of file checkother.cpp.
References Token::astOperand2(), Token::isKeyword(), Token::isStandardType(), Token::link(), Token::Match(), Token::simpleMatch(), Token::str(), and Token::varId().
Referenced by isVarDeclOp().
|
static |
Definition at line 1766 of file checkother.cpp.
References Token::astOperand1(), Token::astOperand2(), isType(), Token::variable(), and Token::varId().
Referenced by isConstStatement().
|
static |
Definition at line 3625 of file checkother.cpp.
References Token::astOperand1(), Token::astOperand2(), Token::simpleMatch(), and Token::varId().
Referenced by CheckOther::checkKnownArgument().
|
static |
Definition at line 3637 of file checkother.cpp.
References Token::astParent(), Token::astSibling(), and Token::simpleMatch().
Referenced by CheckOther::checkKnownArgument().
|
static |
Definition at line 1301 of file checkother.cpp.
References Token::astParent(), Variable::isClass(), Variable::isConst(), Variable::isReference(), Token::Match(), Token::next(), and Token::variable().
Referenced by CheckOther::checkConstVariable().
|
static |
Definition at line 1857 of file checkother.cpp.
References Token::astOperand1(), isCPPCast(), Token::link(), Token::Match(), Token::previous(), and Token::simpleMatch().
Referenced by CheckOther::checkIncompleteStatement().
|
static |
Referenced by CheckOther::signedCharArrayIndexError().
|
static |
Referenced by CheckOther::incompleteArrayFillError().
|
static |
Referenced by CheckOther::checkCastIntToCharAndBackError().
|
static |
Referenced by CheckOther::raceAfterInterlockedDecrementError().
|
static |
Referenced by CheckOther::nanInArithmeticExpressionError(), and CheckOther::zerodivError().
|
static |
Referenced by CheckOther::charBitOpError(), CheckOther::commaSeparatedReturnError(), CheckOther::constStatementError(), CheckOther::constVariableError(), CheckOther::cstyleCastError(), CheckOther::duplicateAssignExpressionError(), CheckOther::duplicateBranchError(), CheckOther::duplicateExpressionError(), CheckOther::duplicateExpressionTernaryError(), CheckOther::duplicateValueTernaryError(), CheckOther::oppositeExpressionError(), CheckOther::passedByValueError(), CheckOther::redundantCopyError(), CheckOther::redundantPointerOpError(), CheckOther::selfAssignmentError(), CheckOther::shadowError(), CheckOther::suspiciousCaseInSwitchError(), CheckOther::suspiciousSemicolonError(), CheckOther::unusedLabelError(), and CheckOther::variableScopeError().
|
static |
Referenced by CheckOther::varFuncNullUBError().
|
static |
|
static |
|
static |
Referenced by CheckOther::checkComparisonFunctionIsAlwaysTrueOrFalseError(), CheckOther::comparePointersError(), CheckOther::knownArgumentError(), CheckOther::knownPointerToBoolError(), CheckOther::pointerLessThanZeroError(), CheckOther::pointerPositiveError(), CheckOther::unsignedLessThanZeroError(), and CheckOther::unsignedPositiveError().
|
static |
|
static |
Referenced by CheckOther::funcArgNamesDifferent().
|
static |
Referenced by CheckOther::accessMovedError().
|
static |
Referenced by CheckOther::funcArgOrderDifferent().
|
static |
Referenced by CheckOther::invalidPointerCastError().
|
static |
Referenced by CheckOther::negativeBitwiseShiftError(), and CheckOther::unknownSignCharArrayIndexError().
|
static |
Referenced by CheckOther::unknownEvaluationOrder().
|
static |
Referenced by CheckOther::clarifyCalculationError(), and CheckOther::clarifyStatementError().