Cppcheck
|
#include "checkcondition.h"
#include "astutils.h"
#include "library.h"
#include "platform.h"
#include "settings.h"
#include "symboldatabase.h"
#include "token.h"
#include "tokenize.h"
#include "utils.h"
#include "vfvalue.h"
#include "checkother.h"
#include <algorithm>
#include <limits>
#include <list>
#include <set>
#include <sstream>
#include <utility>
#include <vector>
Go to the source code of this file.
Functions | |
static bool | isParameterChanged (const Token *partok) |
static void | getnumchildren (const Token *tok, std::list< MathLib::bigint > &numchildren) |
static bool | inBooleanFunction (const Token *tok) |
static bool | isOperandExpanded (const Token *tok) |
static bool | isNonConstFunctionCall (const Token *ftok, const Library &library) |
static std::string | innerSmtString (const Token *tok) |
static std::string | invertOperatorForOperandSwap (std::string s) |
template<typename T > | |
static int | sign (const T v) |
template<typename T > | |
static int | sufficientCondition (std::string op1, const bool not1, const T value1, std::string op2, const bool not2, const T value2, const bool isAnd) |
template<typename T > | |
static bool | checkIntRelation (const std::string &op, const T value1, const T value2) |
static bool | checkFloatRelation (const std::string &op, const double value1, const double value2) |
template<class T > | |
static T | getvalue3 (const T value1, const T value2) |
template<> | |
double | getvalue3 (const double value1, const double value2) |
template<class T > | |
static T | getvalue (const int test, const T value1, const T value2) |
static bool | parseComparison (const Token *comp, bool ¬1, std::string &op, std::string &value, const Token *&expr, bool &inconclusive) |
static std::string | conditionString (bool not1, const Token *expr1, const std::string &op, const std::string &value1) |
static std::string | conditionString (const Token *tok) |
static bool | isIfConstexpr (const Token *tok) |
static int | countPar (const Token *tok1, const Token *tok2) |
Variables | |
static const CWE | uncheckedErrorConditionCWE (391U) |
static const CWE | CWE398 (398U) |
static const CWE | CWE570 (570U) |
static const CWE | CWE571 (571U) |
|
static |
Definition at line 989 of file checkcondition.cpp.
Referenced by CheckCondition::checkIncorrectLogicOperator().
|
static |
Definition at line 979 of file checkcondition.cpp.
Referenced by CheckCondition::checkIncorrectLogicOperator().
|
static |
Definition at line 1084 of file checkcondition.cpp.
References Token::astParent(), and Token::expressionString().
Referenced by CheckCondition::checkIncorrectLogicOperator(), and conditionString().
|
static |
Definition at line 1097 of file checkcondition.cpp.
References Token::astOperand1(), Token::astOperand2(), conditionString(), Token::expressionString(), inconclusive, Token::isComparisonOp(), Token::isName(), Token::Match(), parseComparison(), and Token::str().
Definition at line 1401 of file checkcondition.cpp.
References Token::next().
Referenced by CheckCondition::clarifyCondition().
|
static |
Definition at line 266 of file checkcondition.cpp.
References Token::astOperand1(), Token::astOperand2(), Token::str(), and MathLib::toBigNumber().
Referenced by CheckCondition::comparison().
|
inlinestatic |
Definition at line 1014 of file checkcondition.cpp.
double getvalue3 | ( | const double | value1, |
const double | value2 | ||
) |
Definition at line 1007 of file checkcondition.cpp.
|
static |
Definition at line 998 of file checkcondition.cpp.
|
static |
Definition at line 279 of file checkcondition.cpp.
References Scope::eFunction, Scope::function, Scope::isLocal(), Token::Match(), Scope::nestedIn, Token::next(), Function::retDef, Token::scope(), and Scope::type.
Referenced by CheckCondition::checkBadBitmaskCheck().
|
static |
Definition at line 832 of file checkcondition.cpp.
References Token::astOperand1(), Token::astTop(), and Token::str().
Referenced by CheckCondition::identicalInnerConditionError(), and CheckCondition::oppositeInnerConditionError().
|
static |
Definition at line 914 of file checkcondition.cpp.
Referenced by parseComparison().
|
static |
Definition at line 1119 of file checkcondition.cpp.
References Token::astOperand1(), Token::astTop(), and Token::simpleMatch().
Referenced by CheckCondition::checkIncorrectLogicOperator().
Definition at line 598 of file checkcondition.cpp.
References Token::astOperand1(), Token::function(), Library::isFunctionConst(), Token::next(), Token::str(), and Token::variable().
Referenced by CheckCondition::multiCondition2().
|
static |
Definition at line 296 of file checkcondition.cpp.
References Token::astOperand1(), Token::astOperand2(), Token::isEnumerator(), and Token::isExpandedMacro().
Referenced by CheckCondition::checkBadBitmaskCheck().
|
static |
Definition at line 134 of file checkcondition.cpp.
References Token::function(), Variable::isConst(), Variable::isPointer(), Variable::isReference(), Token::link(), Token::Match(), Token::previous(), and Token::str().
Referenced by CheckCondition::assignIfParseScope(), and CheckCondition::multiCondition2().
|
static |
Definition at line 1037 of file checkcondition.cpp.
References Token::astOperand1(), Token::astOperand2(), inconclusive, invertOperatorForOperandSwap(), Token::isComparisonOp(), MathLib::isFloat(), MathLib::isInt(), op1, op2, and Token::str().
Referenced by CheckCondition::checkIncorrectLogicOperator(), and conditionString().
|
static |
Definition at line 924 of file checkcondition.cpp.
Referenced by astIsCharWithSign(), castValue(), Token::isSigned(), Token::isUnsigned(), Library::load(), SymbolDatabase::setValueTypeInTokenList(), sufficientCondition(), and truncateImplicitConversion().
|
static |
Definition at line 930 of file checkcondition.cpp.
References op1, op2, and sign().
Referenced by CheckCondition::checkIncorrectLogicOperator().
|
static |
Referenced by CheckCondition::assignIfError(), CheckCondition::clarifyConditionError(), CheckCondition::compareValueOutOfTypeRangeError(), CheckCondition::comparisonError(), CheckCondition::duplicateConditionalAssignError(), CheckCondition::duplicateConditionError(), CheckCondition::identicalConditionAfterEarlyExitError(), CheckCondition::identicalInnerConditionError(), CheckCondition::mismatchingBitAndError(), CheckCondition::moduloAlwaysTrueFalseError(), CheckCondition::oppositeElseIfConditionError(), CheckCondition::oppositeInnerConditionError(), CheckCondition::overlappingElseIfConditionError(), and CheckCondition::redundantConditionError().
|
static |
Referenced by CheckCondition::alwaysTrueFalseError(), and CheckCondition::incorrectLogicOperatorError().
|
static |
|
static |
Referenced by CheckCondition::invalidTestForOverflow().