Cppcheck
|
#include "checkleakautovar.h"
#include "astutils.h"
#include "checkmemoryleak.h"
#include "checknullpointer.h"
#include "mathlib.h"
#include "platform.h"
#include "settings.h"
#include "errortypes.h"
#include "symboldatabase.h"
#include "token.h"
#include "tokenize.h"
#include "tokenlist.h"
#include "utils.h"
#include "vfvalue.h"
#include <algorithm>
#include <array>
#include <cstddef>
#include <iostream>
#include <list>
#include <vector>
Go to the source code of this file.
Functions | |
static bool | isAutoDeallocType (const Type *type) |
static bool | isAutoDealloc (const Variable *var) |
Is variable type some class with automatic deallocation? More... | |
template<std::size_t N> | |
static bool | isVarTokComparison (const Token *tok, const Token **vartok, const std::array< std::pair< std::string, std::string >, N > &ops) |
static bool | isVarUsedInTree (const Token *tok, nonneg int varid) |
static bool | isPointerReleased (const Token *startToken, const Token *endToken, nonneg int varid) |
static bool | isLocalVarNoAutoDealloc (const Token *varTok) |
static const Token * | isFunctionCall (const Token *nameToken) |
checks if nameToken is a name of a function in a function call: func(arg) or func<temp1_arg>(arg) More... | |
static const Token * | getOutparamAllocation (const Token *tok, const Settings &settings) |
Variables | |
static const CWE | CWE672 (672U) |
static const CWE | CWE415 (415U) |
static constexpr int | NEW_ARRAY = -2 |
static constexpr int | NEW = -1 |
static const std::array< std::pair< std::string, std::string >, 4 > | alloc_failed_conds {{{"==", "0"}, {"<", "0"}, {"==", "-1"}, {"<=", "-1"}}} |
static const std::array< std::pair< std::string, std::string >, 4 > | alloc_success_conds {{{"!=", "0"}, {">", "0"}, {"!=", "-1"}, {">=", "0"}}} |
Definition at line 1100 of file checkleakautovar.cpp.
References Library::getAllocFuncInfo(), getTokenArgumentFunction(), and Settings::library.
Referenced by CheckLeakAutoVar::ret().
|
static |
Is variable type some class with automatic deallocation?
var | variable token |
Definition at line 85 of file checkleakautovar.cpp.
References isAutoDeallocType(), Variable::type(), ValueType::type, and Variable::valueType().
Referenced by isLocalVarNoAutoDealloc().
|
static |
Definition at line 63 of file checkleakautovar.cpp.
References Type::classScope, Type::derivedFrom, Scope::numConstructors, and Scope::varlist.
Referenced by isAutoDealloc().
checks if nameToken is a name of a function in a function call: func(arg) or func<temp1_arg>(arg)
nameToken | Function name token |
Definition at line 289 of file checkleakautovar.cpp.
References Token::isCast(), Token::isName(), Token::isStandardType(), Token::link(), Token::next(), and Token::str().
Referenced by CheckLeakAutoVar::checkScope(), and CheckLeakAutoVar::checkTokenInsideExpression().
|
static |
Definition at line 257 of file checkleakautovar.cpp.
References Variable::isArgument(), isAutoDealloc(), Token::isCpp(), Variable::isLocal(), Variable::isPointer(), Variable::isReference(), Token::isStandardType(), Variable::isStatic(), Token::Match(), Variable::typeStartToken(), and Token::variable().
Referenced by CheckLeakAutoVar::checkScope().
|
static |
Definition at line 244 of file checkleakautovar.cpp.
References Token::Match(), and Token::next().
Referenced by CheckLeakAutoVar::checkScope().
|
static |
Definition at line 97 of file checkleakautovar.cpp.
Referenced by CheckLeakAutoVar::checkScope().
Definition at line 233 of file checkleakautovar.cpp.
References Token::astOperand1(), Token::astOperand2(), Token::simpleMatch(), Token::str(), and Token::varId().
Referenced by CheckLeakAutoVar::checkScope().
|
static |
Definition at line 60 of file checkleakautovar.cpp.
Referenced by CheckLeakAutoVar::checkScope().
|
static |
Definition at line 61 of file checkleakautovar.cpp.
Referenced by CheckLeakAutoVar::checkScope().
|
static |
Referenced by CheckLeakAutoVar::doubleFreeError().
|
static |
Referenced by CheckLeakAutoVar::deallocReturnError().
|
staticconstexpr |
Definition at line 58 of file checkleakautovar.cpp.
Referenced by CheckLeakAutoVar::checkScope(), and CheckLeakAutoVar::functionCall().
|
staticconstexpr |
Definition at line 57 of file checkleakautovar.cpp.
Referenced by CheckLeakAutoVar::checkScope(), and CheckLeakAutoVar::functionCall().