|
Cppcheck
|
#include "checkother.h"#include "mathlib.h"#include "symboldatabase.h"#include <cmath>#include <stack>#include <algorithm>Go to the source code of this file.
Classes | |
| struct | Condition |
Enumerations | |
| enum | Position { First, Second, NA } |
| enum | Relation { Equal, NotEqual, Less, LessEqual, More, MoreEqual } |
Functions | |
| static std::string | analyzeType (const Token *tok) |
| static bool | nonLocal (const Variable *var) |
| static void | eraseNotLocalArg (std::map< unsigned int, const Token * > &container, const SymbolDatabase *symbolDatabase) |
| static bool | isFunctionOrBreakPattern (const Token *tok) |
| static bool | isTypeWithoutSideEffects (const Tokenizer *tokenizer, const Variable *var) |
| static const Token * | findSelfAssignPattern (const Token *start) |
| static std::string | invertOperatorForOperandSwap (std::string s) |
| static bool | analyzeLogicOperatorCondition (const Condition &c1, const Condition &c2, bool inv1, bool inv2, bool varFirst1, bool varFirst2, const std::string &firstConstant, const std::string &secondConstant, const Token *op1Tok, const Token *op3Tok, Relation relation) |
| static bool | isChar (const Variable *var) |
| static bool | isSignedChar (const Variable *var) |
| static bool | expressionHasSideEffects (const Token *first, const Token *last) |
| enum Position |
Definition at line 1188 of file checkother.cpp.
| enum Relation |
Definition at line 1189 of file checkother.cpp.
| static bool analyzeLogicOperatorCondition | ( | const Condition & | c1, |
| const Condition & | c2, | ||
| bool | inv1, | ||
| bool | inv2, | ||
| bool | varFirst1, | ||
| bool | varFirst2, | ||
| const std::string & | firstConstant, | ||
| const std::string & | secondConstant, | ||
| const Token * | op1Tok, | ||
| const Token * | op3Tok, | ||
| Relation | relation | ||
| ) | [static] |
Definition at line 1206 of file checkother.cpp.
References Equal, First, invertOperatorForOperandSwap(), MathLib::isEqual(), MathLib::isGreater(), MathLib::isGreaterEqual(), MathLib::isLess(), MathLib::isLessEqual(), MathLib::isNotEqual(), Less, LessEqual, Token::Match(), More, MoreEqual, NA, NotEqual, Condition::opTokStr, Condition::position, and Second.
Referenced by CheckOther::checkIncorrectLogicOperator().
| static std::string analyzeType | ( | const Token * | tok | ) | [static] |
Definition at line 407 of file checkother.cpp.
References Token::isLong(), Token::Match(), and Token::str().
Referenced by CheckOther::invalidPointerCast().
| static void eraseNotLocalArg | ( | std::map< unsigned int, const Token * > & | container, |
| const SymbolDatabase * | symbolDatabase | ||
| ) | [static] |
Definition at line 587 of file checkother.cpp.
References SymbolDatabase::getVariableFromVarId(), and nonLocal().
Referenced by CheckOther::checkRedundantAssignment().
| static bool expressionHasSideEffects | ( | const Token * | first, |
| const Token * | last | ||
| ) | [static] |
Definition at line 2299 of file checkother.cpp.
References Token::eIncDecOp, Token::Match(), and Token::next().
Referenced by CheckOther::checkDuplicateIf().
| static const Token* findSelfAssignPattern | ( | const Token * | start | ) | [inline, static] |
Definition at line 1125 of file checkother.cpp.
References Token::findmatch().
Referenced by CheckOther::checkSelfAssignment().
| static std::string invertOperatorForOperandSwap | ( | std::string | s | ) | [static] |
Definition at line 1195 of file checkother.cpp.
Referenced by analyzeLogicOperatorCondition(), and CheckOther::checkIncorrectLogicOperator().
Definition at line 1922 of file checkother.cpp.
References Variable::isArray(), Variable::isPointer(), Token::str(), and Variable::typeStartToken().
Referenced by isSignedChar(), and CheckOther::strPlusChar().
| static bool isFunctionOrBreakPattern | ( | const Token * | tok | ) | [inline, static] |
Definition at line 773 of file checkother.cpp.
References Token::Match().
Referenced by CheckOther::checkRedundantAssignmentInSwitch().
| static bool isSignedChar | ( | const Variable * | var | ) | [static] |
Definition at line 1927 of file checkother.cpp.
References isChar(), Token::isUnsigned(), and Variable::typeStartToken().
Referenced by CheckOther::checkCharVariable().
| static bool isTypeWithoutSideEffects | ( | const Tokenizer * | tokenizer, |
| const Variable * | var | ||
| ) | [static] |
Definition at line 1120 of file checkother.cpp.
References Variable::isClass(), Tokenizer::isCPP(), Variable::isPointer(), Token::simpleMatch(), and Variable::typeStartToken().
Referenced by CheckOther::checkSelfAssignment().
Definition at line 582 of file checkother.cpp.
References Variable::isArgument(), Variable::isLocal(), Variable::isReference(), and Variable::isStatic().
Referenced by CheckOther::checkRedundantAssignment(), and eraseNotLocalArg().
1.7.6.1