Cppcheck
|
#include "symboldatabase.h"
#include "astutils.h"
#include "errorlogger.h"
#include "errortypes.h"
#include "keywords.h"
#include "library.h"
#include "mathlib.h"
#include "path.h"
#include "platform.h"
#include "settings.h"
#include "standards.h"
#include "templatesimplifier.h"
#include "token.h"
#include "tokenize.h"
#include "tokenlist.h"
#include "utils.h"
#include "valueflow.h"
#include <algorithm>
#include <cassert>
#include <cstring>
#include <initializer_list>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
Go to the source code of this file.
Functions | |
static const Token * | skipScopeIdentifiers (const Token *tok) |
static bool | isExecutableScope (const Token *tok) |
static bool | isEnumDefinition (const Token *tok) |
static bool | isContainerYieldElement (Library::Container::Yield yield) |
static bool | isExpression (const Token *tok) |
static std::string | getIncompleteNameID (const Token *tok) |
static bool | isOperator (const Token *tokenDef) |
static std::string | qualifiedName (const Scope *scope) |
static bool | usingNamespace (const Scope *scope, const Token *first, const Token *second, int &offset) |
static bool | typesMatch (const Scope *first_scope, const Token *first_token, const Scope *second_scope, const Token *second_token, const Token *&new_first, const Token *&new_second) |
static bool | isUnknownType (const Token *start, const Token *end) |
static const Token * | getEnableIfReturnType (const Token *start) |
template<class Predicate > | |
static bool | checkReturns (const Function *function, bool unknown, bool emptyEnableIf, Predicate pred) |
static std::string | scopeTypeToString (Scope::ScopeType type) |
static std::ostream & | operator<< (std::ostream &s, Scope::ScopeType type) |
static std::string | accessControlToString (AccessControl access) |
static const char * | functionTypeToString (Function::Type type) |
static std::string | tokenToString (const Token *tok, const Tokenizer &tokenizer) |
static std::string | scopeToString (const Scope *scope, const Tokenizer &tokenizer) |
static std::string | tokenType (const Token *tok) |
static const Type * | findVariableTypeIncludingUsedNamespaces (const SymbolDatabase *symbolDatabase, const Scope *scope, const Token *typeTok) |
static bool | isDerivedFromItself (const std::string &thisName, const std::string &baseName) |
static const Token * | skipPointers (const Token *tok) |
static const Token * | skipPointersAndQualifiers (const Token *tok) |
static const Scope * | findEnumScopeInBase (const Scope *scope, const std::string &tokStr) |
static bool | hasEmptyCaptureList (const Token *tok) |
static void | checkVariableCallMatch (const Variable *callarg, const Variable *funcarg, size_t &same, size_t &fallback1, size_t &fallback2) |
static std::string | getTypeString (const Token *typeToken) |
static bool | hasMatchingConstructor (const Scope *classScope, const ValueType *argType) |
template<class S , class T , REQUIRES("S must be a Scope class", std::is_convertible< S *, const Scope * >) , REQUIRES("T must be a Type class", std::is_convertible< T *, const Type * >) > | |
S * | findRecordInNestedListImpl (S &thisScope, const std::string &name, bool isC) |
template<class S , class T , REQUIRES("S must be a Scope class", std::is_convertible< S *, const Scope * >) , REQUIRES("T must be a Type class", std::is_convertible< T *, const Type * >) > | |
T * | findTypeImpl (S &thisScope, const std::string &name) |
static const Token * | parsedecl (const Token *type, ValueType *const valuetype, ValueType::Sign defaultSignedness, const Settings &settings, SourceLocation loc=SourceLocation::current()) |
static ValueType::Type | getEnumType (const Scope *scope, const Platform &platform) |
static void | setAutoTokenProperties (Token *const autoTok) |
static bool | isContainerYieldPointer (Library::Container::Yield yield) |
static const Scope * | getClassScope (const Token *tok) |
static const Function * | getOperatorFunction (const Token *const tok) |
static const Function * | getFunction (const Token *tok) |
|
static |
Definition at line 3776 of file symboldatabase.cpp.
References Argument, Global, Local, Namespace, Private, Protected, Public, and Throw.
Referenced by SymbolDatabase::printOut(), SymbolDatabase::printVariable(), and SymbolDatabase::printXml().
|
static |
Definition at line 3065 of file symboldatabase.cpp.
References Function::eFunction, Function::eOperatorEqual, getEnableIfReturnType(), isUnknownType(), Token::link(), Token::Match(), Token::previous(), Token::simpleMatch(), and Token::tokAt().
Referenced by Function::returnsConst(), Function::returnsPointer(), Function::returnsReference(), Function::returnsStandardType(), and Function::returnsVoid().
|
static |
Definition at line 5554 of file symboldatabase.cpp.
References ValueType::FALLBACK1, ValueType::FALLBACK2, Variable::isArrayOrPointer(), Token::isLong(), Variable::isStlStringType(), Token::isUnsigned(), Token::Match(), ValueType::matchParameter(), ValueType::NOMATCH, ValueType::SAME, Token::str(), Token::strAt(), Variable::typeStartToken(), and Variable::valueType().
Referenced by Scope::findFunction().
Definition at line 5168 of file symboldatabase.cpp.
References Type::classScope, Scope::definedType, Type::derivedFrom, Scope::findRecordInNestedList(), and Type::type().
Referenced by SymbolDatabase::findEnumerator().
S* findRecordInNestedListImpl | ( | S & | thisScope, |
const std::string & | name, | ||
bool | isC | ||
) |
Definition at line 6078 of file symboldatabase.cpp.
References Scope::eFunction.
T* findTypeImpl | ( | S & | thisScope, |
const std::string & | name | ||
) |
Definition at line 6116 of file symboldatabase.cpp.
References emptyString.
|
static |
Definition at line 4389 of file symboldatabase.cpp.
References SymbolDatabase::findVariableType(), Scope::nestedIn, Scope::UsingInfo::scope, and Scope::usingList.
Referenced by Function::addArguments(), and Scope::checkVariable().
|
static |
Definition at line 3799 of file symboldatabase.cpp.
References Function::eConstructor, Function::eCopyConstructor, Function::eDestructor, Function::eFunction, Function::eLambda, Function::eMoveConstructor, and Function::eOperatorEqual.
Referenced by SymbolDatabase::printOut(), and SymbolDatabase::printXml().
Definition at line 7288 of file symboldatabase.cpp.
References Scope::isClassOrStruct(), ValueType::typeScope, and Token::valueType().
Referenced by getOperatorFunction(), and SymbolDatabase::setValueTypeInTokenList().
Definition at line 3049 of file symboldatabase.cpp.
References Token::link(), Token::Match(), Token::next(), precedes(), and Token::simpleMatch().
Referenced by checkReturns().
|
static |
Definition at line 7039 of file symboldatabase.cpp.
References Token::astOperand2(), Scope::bodyEnd, Scope::bodyStart, Token::getKnownIntValue(), Token::hasKnownIntValue(), Token::isAssignmentOp(), Platform::isIntValue(), Token::isLiteral(), Platform::isLongValue(), Token::next(), and Token::valueType().
Referenced by parsedecl(), and SymbolDatabase::setValueType().
Definition at line 7317 of file symboldatabase.cpp.
References Token::function(), Token::Match(), Token::simpleMatch(), and Token::variable().
Referenced by SymbolDatabase::setValueTypeInTokenList().
|
static |
Definition at line 1551 of file symboldatabase.cpp.
References Token::astParent(), Token::expressionString(), Token::Match(), and Token::str().
Referenced by SymbolDatabase::createSymbolDatabaseExprIds().
Definition at line 7295 of file symboldatabase.cpp.
References Token::astOperand1(), Token::astOperand2(), Scope::functionMap, getClassScope(), and Token::str().
Referenced by SymbolDatabase::setValueTypeInTokenList().
|
static |
Definition at line 5598 of file symboldatabase.cpp.
References Token::link(), Token::Match(), Token::next(), Token::str(), Token::strAt(), and Token::tokAt().
Referenced by Scope::findFunction(), and ValueType::matchParameter().
|
static |
Definition at line 5461 of file symboldatabase.cpp.
References Token::astParent(), and Token::simpleMatch().
Definition at line 5625 of file symboldatabase.cpp.
References Scope::functionList.
Referenced by Scope::findFunction().
|
static |
Definition at line 6530 of file symboldatabase.cpp.
References Library::Container::AT_INDEX, Library::Container::BUFFER, Library::Container::BUFFER_NT, and Library::Container::ITEM.
Referenced by SymbolDatabase::createSymbolDatabaseSetVariablePointers(), and SymbolDatabase::setValueType().
|
static |
Definition at line 6536 of file symboldatabase.cpp.
References Library::Container::BUFFER, and Library::Container::BUFFER_NT.
Referenced by SymbolDatabase::setValueType().
|
static |
Definition at line 4600 of file symboldatabase.cpp.
Referenced by Function::getOverriddenFunctionRecursive().
|
static |
Definition at line 126 of file symboldatabase.cpp.
References Token::Match(), Token::next(), Token::simpleMatch(), and Token::str().
Referenced by SymbolDatabase::createSymbolDatabaseFindAllScopes().
|
static |
Definition at line 106 of file symboldatabase.cpp.
References findLambdaStartToken(), Token::link(), Token::Match(), Token::previous(), and Token::simpleMatch().
Referenced by SymbolDatabase::createSymbolDatabaseFindAllScopes().
|
static |
Definition at line 1529 of file symboldatabase.cpp.
References Token::astOperand1(), Token::astOperand2(), findAstNode(), Token::Match(), Variable::nameToken(), Token::scope(), Token::simpleMatch(), and Token::variable().
Referenced by SymbolDatabase::createSymbolDatabaseExprIds().
|
static |
Definition at line 2484 of file symboldatabase.cpp.
References Token::isOperatorKeyword(), startsWith(), and Token::str().
Definition at line 3036 of file symboldatabase.cpp.
References Token::isStandardType(), Token::Match(), Token::next(), skipScopeIdentifiers(), Token::tokAt(), and Token::type().
Referenced by checkReturns().
|
static |
Definition at line 3770 of file symboldatabase.cpp.
References scopeTypeToString().
|
static |
Definition at line 7065 of file symboldatabase.cpp.
References TokenList::addtoken(), Scope::check, Settings::clang, ValueType::constness, ValueType::container, ValueType::containerTypeToken, Settings::debugnormal, Settings::debugwarnings, Library::detectContainerOrIterator(), Library::detectSmartPointer(), Scope::eEnum, endsWith(), Scope::enumType, SymbolDatabase::findScope(), Token::findsimplematch(), ValueType::fromLibraryType(), TokenList::front(), Token::function(), getEnumType(), Token::isCpp(), ValueType::isIntegral(), isIterator(), Token::isLong(), Token::isName(), Token::isSigned(), Token::isStandardType(), Token::isUnsigned(), Settings::library, Token::link(), Token::linkAt(), LValue, Token::Match(), Token::next(), Token::nextTemplateArgument(), None, Token::originalName(), ValueType::originalTypeName, Settings::platform, ValueType::pointer, Token::previous(), ValueType::reference, RValue, Token::scope(), ValueType::setDebugPath(), ValueType::sign, Token::simpleMatch(), ValueType::smartPointer, ValueType::smartPointerType, ValueType::smartPointerTypeToken, Token::str(), Token::tokAt(), Scope::type, ValueType::type, Token::type(), ValueType::typeFromString(), ValueType::typeScope, Token::valueType(), Token::variable(), Token::varId(), and ValueType::volatileness.
Referenced by ValueType::parseDecl(), SymbolDatabase::setValueType(), and SymbolDatabase::setValueTypeInTokenList().
|
static |
Definition at line 2691 of file symboldatabase.cpp.
References Scope::className, and Scope::nestedIn.
Referenced by usingNamespace().
Definition at line 3832 of file symboldatabase.cpp.
References Scope::classDef, Scope::className, TokenList::fileLine(), Tokenizer::list, and Scope::type.
Referenced by SymbolDatabase::printOut(), and SymbolDatabase::printVariable().
|
static |
Definition at line 3729 of file symboldatabase.cpp.
Referenced by operator<<(), and SymbolDatabase::printXml().
|
static |
Definition at line 6523 of file symboldatabase.cpp.
References ValueType::isFloat(), ValueType::isIntegral(), Token::isStandardType(), and Token::valueType().
Referenced by SymbolDatabase::setValueType().
Definition at line 4990 of file symboldatabase.cpp.
References Token::link(), Token::linkAt(), Token::Match(), Token::next(), Token::simpleMatch(), Token::strAt(), and Token::tokAt().
Referenced by Scope::isVariableDeclaration(), and skipPointersAndQualifiers().
Definition at line 5007 of file symboldatabase.cpp.
References Token::Match(), Token::next(), and skipPointers().
Referenced by Scope::isVariableDeclaration().
Definition at line 91 of file symboldatabase.cpp.
References Token::linkAt(), Token::Match(), Token::next(), Token::strAt(), and Token::tokAt().
Referenced by isUnknownType(), Scope::isVariableDeclaration(), and Scope::Scope().
Definition at line 3821 of file symboldatabase.cpp.
References TokenList::fileLine(), Tokenizer::list, and Token::str().
Referenced by SymbolDatabase::printOut(), and SymbolDatabase::printVariable().
|
static |
Definition at line 3846 of file symboldatabase.cpp.
References Token::isComplex(), Token::isLong(), Token::isSigned(), Token::isUnsigned(), and Token::str().
Referenced by SymbolDatabase::printOut(), and SymbolDatabase::printVariable().
|
static |
Definition at line 2763 of file symboldatabase.cpp.
References Scope::check, SymbolDatabase::findType(), Type::name(), Token::next(), Token::previous(), and Token::str().
Referenced by Function::argsMatch().
|
static |
Definition at line 2702 of file symboldatabase.cpp.
References Token::Match(), match(), Scope::nestedIn, Token::next(), qualifiedName(), Token::str(), Token::tokAt(), and Scope::usingList.
Referenced by Function::argsMatch().