Cppcheck
|
The main purpose is to tokenize the source code. More...
#include <tokenize.h>
Classes | |
struct | TypedefInfo |
Public Member Functions | |
Tokenizer (const Settings &settings, ErrorLogger &errorLogger) | |
~Tokenizer () | |
void | setTimerResults (TimerResults *tr) |
bool | isC () const |
Is the code C. More... | |
bool | isCPP () const |
Is the code CPP. More... | |
bool | isScopeNoReturn (const Token *endScopeToken, bool *unknown=nullptr) const |
Check if inner scope ends with a call to a noreturn function. More... | |
bool | simplifyTokens1 (const std::string &configuration) |
nonneg int | sizeOfType (const Token *type) const |
Calculates sizeof value for given type. More... | |
nonneg int | sizeOfType (const std::string &type) const |
bool | hasIfdef (const Token *start, const Token *end) const |
bool | isPacked (const Token *bodyStart) const |
NORETURN void | syntaxError (const Token *tok, const std::string &code=emptyString) const |
Syntax error. More... | |
NORETURN void | unmatchedToken (const Token *tok) const |
Syntax error. More... | |
NORETURN void | syntaxErrorC (const Token *tok, const std::string &what) const |
Syntax error. More... | |
NORETURN void | unknownMacroError (const Token *tok1) const |
Warn about unknown macro(s), configuration is recommended. More... | |
void | unhandledCharLiteral (const Token *tok, const std::string &msg) const |
const SymbolDatabase * | getSymbolDatabase () const |
void | createSymbolDatabase () |
void | printDebugOutput (int simplification) const |
print –debug output if debug flags match the simplification: 0=unknown/both simplifications 1=1st simplifications 2=2nd simplifications More... | |
void | dump (std::ostream &out) const |
Token * | deleteInvalidTypedef (Token *typeDef) |
nonneg int | varIdCount () const |
Get variable count. More... | |
const Token * | tokens () const |
Token * | tokens () |
const Settings & | getSettings () const |
void | calculateScopes () |
Tokenizer (const Tokenizer &)=delete | |
Disable copy constructor. More... | |
Tokenizer & | operator= (const Tokenizer &)=delete |
Disable assignment operator. More... | |
void | setDirectives (std::list< Directive > directives) |
Static Public Member Functions | |
static const Token * | isFunctionHead (const Token *tok, const std::string &endsWith) |
is token pointing at function head? More... | |
static bool | isOneNumber (const std::string &s) |
Helper function to check whether number is one (1 or 0.1E+1 or 1E+0) or not? More... | |
static const Token * | startOfExecutableScope (const Token *tok) |
Helper function to check for start of function execution scope. More... | |
Public Attributes | |
TokenList | list |
Token list: stores all tokens. More... | |
Private Member Functions | |
void | setVarId () |
Set variable id. More... | |
void | setVarIdPass1 () |
void | setVarIdPass2 () |
bool | simplifyTokenList1 (const char FileName[]) |
Basic simplification of tokenlist. More... | |
void | simplifyHeadersAndUnusedTemplates () |
If –check-headers=no has been given; then remove unneeded code in headers. More... | |
void | removeExtraTemplateKeywords () |
Remove extra "template" keywords that are not used by Cppcheck. More... | |
void | splitTemplateRightAngleBrackets (bool check) |
Split up template right angle brackets. More... | |
void | simplifyDebug () |
void | simplifyAssignmentBlock () |
Simplify assignment where rhs is a block : "x=({123;});" => "{x=123;}". More... | |
void | arraySize () |
Insert array size where it isn't given. More... | |
void | arraySizeAfterValueFlow () |
void | simplifyLabelsCaseDefault () |
Simplify labels and 'case|default' syntaxes. More... | |
void | simplifyCaseRange () |
simplify case ranges (gcc extension) More... | |
void | removeMacrosInGlobalScope () |
Remove macros in global scope. More... | |
void | addSemicolonAfterUnknownMacro () |
void | removePragma () |
void | removeMacroInClassDef () |
Remove undefined macro in class definition: class DLLEXPORT Fred { }; class Fred FINAL : Base { };. More... | |
void | sizeofAddParentheses () |
Add parentheses for sizeof: sizeof x => sizeof(x) More... | |
void | simplifyVarDecl (const bool only_k_r_fpar) |
Simplify variable declarations (split up) More... | |
void | simplifyVarDecl (Token *tokBegin, const Token *const tokEnd, const bool only_k_r_fpar) |
void | simplifyInitVar () |
Simplify variable initialization '; int *p(0);' => '; int *p = 0;'. More... | |
void | simplifyStaticConst () |
Simplify the location of "static" and "const" qualifiers in a variable declaration or definition. More... | |
void | simplifyVariableMultipleAssign () |
Simplify multiple assignments. More... | |
bool | simplifyCAlternativeTokens () |
Simplify the 'C Alternative Tokens' Examples: "if(s and t)" => "if(s && t)" "while((r bitand s) and not t)" => while((r & s) && !t)"
"a and_eq b;" => "a &= b;". More... | |
bool | simplifyAddBraces () |
Add braces to an if-block, for-block, etc. More... | |
Token * | simplifyAddBracesToCommand (Token *tok) |
Add braces to an if-block, for-block, etc. More... | |
Token * | simplifyAddBracesPair (Token *tok, bool commandWithCondition) |
Add pair of braces to an single if-block, else-block, for-block, etc. More... | |
void | simplifyUsingToTypedef () |
void | simplifyTypedef () |
typedef A mytype; mytype c; More... | |
void | simplifyTypedefCpp () |
void | simplifyTypedefLHS () |
Move typedef token to the left og the expression. More... | |
bool | simplifyUsing () |
void | simplifyUsingError (const Token *usingStart, const Token *usingEnd) |
void | simplifyEmptyNamespaces () |
Simplify useless C++ empty namespaces, like: 'namespace name% { }'. More... | |
void | elseif () |
Simplify "if else". More... | |
void | simplifyIfSwitchForInit () |
Simplify C++17/C++20 if/switch/for initialization expression. More... | |
void | removeRedundantSemicolons () |
Reduces "; ;" to ";", except in "( ; ; )". More... | |
void | simplifyStructDecl () |
Struct simplification "struct S { } s;" => "struct S { }; S s;". More... | |
bool | simplifyRedundantParentheses () |
Remove redundant parentheses: More... | |
void | simplifyFunctionParameters () |
Simplify functions like "void f(x) int x; {" into "void f(int x) {". More... | |
void | simplifyFunctionTryCatch () |
Simplify function level try blocks: Convert "void f() try {} catch (int) {}" to "void f() { try {} catch (int) {} }". More... | |
void | simplifyTemplates () |
Simplify templates. More... | |
void | simplifyDoublePlusAndDoubleMinus () |
void | simplifyRedundantConsecutiveBraces () |
void | simplifyArrayAccessSyntax () |
void | simplifyParameterVoid () |
void | fillTypeSizes () |
void | combineOperators () |
void | combineStringAndCharLiterals () |
void | concatenateNegativeNumberAndAnyPositive () |
void | simplifyExternC () |
void | simplifyRoundCurlyParentheses () |
void | simplifyTypeIntrinsics () |
void | simplifySQL () |
void | checkForEnumsWithTypedef () |
void | findComplicatedSyntaxErrorsInTemplates () |
void | simplifyPointerToStandardType () |
Simplify pointer to standard type (C only) More... | |
void | simplifyFunctionPointers () |
Simplify function pointers. More... | |
NORETURN void | cppcheckError (const Token *tok) const |
Send error message to error logger about internal bug. More... | |
void | createLinks () |
Setup links for tokens so that one can call Token::link(). More... | |
void | createLinks2 () |
Setup links between < and >. More... | |
void | markCppCasts () |
Set isCast() for C++ casts. More... | |
void | unhandled_macro_class_x_y (const Token *tok) const |
Report that there is an unhandled "class x y {" code. More... | |
void | checkConfiguration () const |
Check configuration (unknown macros etc) More... | |
void | macroWithSemicolonError (const Token *tok, const std::string ¯oName) const |
void | validateC () const |
Is there C++ code in C file? More... | |
void | validate () const |
assert that tokens are ok - used during debugging for example to catch problems in simplifyTokenList1/2. More... | |
void | reportUnknownMacros () const |
Detect unknown macros and throw unknownMacro. More... | |
void | findGarbageCode () const |
Detect garbage code and call syntaxError() if found. More... | |
void | simplifyDeclspec () |
Remove __declspec() More... | |
void | simplifyCallingConvention () |
Remove calling convention. More... | |
void | simplifyAttribute () |
Remove __attribute__ ((?)) More... | |
Token * | getAttributeFuncTok (Token *tok, bool gccattr) const |
Get function token for a attribute. More... | |
void | simplifyCppcheckAttribute () |
Remove __cppcheck__ ((?)) More... | |
void | simplifySpaceshipOperator () |
Simplify c++20 spaceship operator. More... | |
void | simplifyKeyword () |
Remove keywords "volatile", "inline", "register", and "restrict". More... | |
void | simplifyAsm () |
Remove __asm. More... | |
void | simplifyAsm2 () |
asm heuristics, Put ^{} statements in asm() More... | |
void | simplifyAt () |
Simplify @… (compiler extension) More... | |
void | simplifyBitfields () |
Simplify bitfields - the field width is removed as we don't use it. More... | |
void | removeUnnecessaryQualification () |
Remove unnecessary member qualification. More... | |
void | simplifyNamespaceStd () |
Add std:: in front of std classes, when using namespace std; was given. More... | |
void | simplifyMicrosoftMemoryFunctions () |
Convert Microsoft memory functions CopyMemory(dst, src, len) -> memcpy(dst, src, len) FillMemory(dst, len, val) -> memset(dst, val, len) MoveMemory(dst, src, len) -> memmove(dst, src, len) ZeroMemory(dst, len) -> memset(dst, 0, len) More... | |
void | simplifyMicrosoftStringFunctions () |
Convert Microsoft string functions _tcscpy -> strcpy. More... | |
void | simplifyBorland () |
Remove Borland code. More... | |
void | simplifyOperatorName () |
Collapse operator name tokens into single token operator = => operator=. More... | |
void | simplifyOverloadedOperators () |
simplify overloaded operators: 'obj(123)' => 'obj . More... | |
void | simplifyCPPAttribute () |
Remove [[attribute]] (C++11, C23) from TokenList. More... | |
void | simplifyNamespaceAliases () |
Convert namespace aliases. More... | |
void | simplifyNestedNamespace () |
Convert C++17 style nested namespace to older style. More... | |
void | simplifyCoroutines () |
Simplify coroutines - just put parentheses around arguments for co_* keywords so they can be handled like function calls in data flow. More... | |
void | prepareTernaryOpForAST () |
Prepare ternary operators with parentheses so that the AST can be created. More... | |
void | reportError (const Token *tok, const Severity severity, const std::string &id, const std::string &msg, bool inconclusive=false) const |
report error message More... | |
void | reportError (const std::list< const Token * > &callstack, Severity severity, const std::string &id, const std::string &msg, bool inconclusive=false) const |
bool | duplicateTypedef (Token *&tokPtr, const Token *name, const Token *typeDef) const |
void | unsupportedTypedef (const Token *tok) const |
void | printUnknownTypes () const |
Output list of unknown types. More... | |
const Token * | processFunc (const Token *tok2, bool inOperator) const |
Token * | processFunc (Token *tok2, bool inOperator) |
nonneg int | newVarId () |
Get new variable id. More... | |
void | setPodTypes () |
Set pod types. More... | |
Static Private Member Functions | |
static Token * | initVar (Token *tok) |
static bool | isMemberFunction (const Token *openParen) |
static std::string | simplifyString (const std::string &source) |
Modify strings in the token list by replacing hex and oct values. More... | |
static bool | isGarbageExpr (const Token *start, const Token *end, bool allowSemicolon) |
Detect garbage expression. More... | |
static void | setVarIdClassFunction (const std::string &classname, Token *const startToken, const Token *const endToken, const std::map< std::string, nonneg int > &varlist, std::map< nonneg int, std::map< std::string, nonneg int >> &structMembers, nonneg int &varId_) |
static const Token * | findSQLBlockEnd (const Token *tokSQLStart) |
Find end of SQL (or PL/SQL) block. More... | |
static bool | operatorEnd (const Token *tok) |
Private Attributes | |
const Settings & | mSettings |
settings More... | |
ErrorLogger & | mErrorLogger |
errorlogger More... | |
SymbolDatabase * | mSymbolDatabase {} |
Symbol database that all checks etc can use. More... | |
TemplateSimplifier *const | mTemplateSimplifier |
std::string | mConfiguration |
E.g. More... | |
std::map< std::string, int > | mTypeSize |
sizeof information for known types More... | |
std::vector< TypedefInfo > | mTypedefInfo |
std::list< Directive > | mDirectives |
nonneg int | mVarId {} |
variable count More... | |
nonneg int | mUnnamedCount {} |
unnamed count "Unnamed0", "Unnamed1", "Unnamed2", ... More... | |
TimerResults * | mTimerResults {} |
TimerResults. More... | |
Friends | |
class | SymbolDatabase |
class | TemplateSimplifier |
class | TestSimplifyTemplate |
class | TestSimplifyTypedef |
class | TestTokenizer |
The main purpose is to tokenize the source code.
It also has functions that simplify the token list
Definition at line 46 of file tokenize.h.
|
explicit |
Definition at line 161 of file tokenize.cpp.
Tokenizer::~Tokenizer | ( | ) |
Definition at line 168 of file tokenize.cpp.
References mSymbolDatabase, and mTemplateSimplifier.
|
delete |
Disable copy constructor.
|
private |
Definition at line 6504 of file tokenize.cpp.
References TokenList::front(), Token::insertToken(), isCPP(), Token::isName(), Token::link(), list, Token::Match(), Token::next(), Token::simpleMatch(), and Token::str().
Referenced by simplifyTokenList1().
|
private |
Insert array size where it isn't given.
Specify array size if it hasn't been given.
Definition at line 3770 of file tokenize.cpp.
References Token::deleteNext(), TokenList::front(), Token::getStrArraySize(), Token::insertToken(), Token::isName(), Token::link(), Token::linkAt(), list, Token::Match(), Token::next(), Token::previous(), Token::simpleMatch(), Token::str(), Token::strAt(), MathLib::toBigUNumber(), and Token::tokAt().
Referenced by simplifyTokenList1().
|
private |
Definition at line 3843 of file tokenize.cpp.
References Token::addValue(), Token::astOperand1(), Token::astOperand2(), Token::getKnownIntValue(), Token::hasKnownIntValue(), Token::insertToken(), Token::link(), Token::linkAt(), Token::Match(), mSymbolDatabase, Token::next(), Dimension::num, Token::scope(), ValueFlow::Value::setKnown(), Token::simpleMatch(), Token::tokAt(), and SymbolDatabase::variableList().
Referenced by simplifyTokens1().
void Tokenizer::calculateScopes | ( | ) |
Definition at line 4015 of file tokenize.cpp.
References Token::findOpeningBracket(), TokenList::front(), Token::link(), Token::linkAt(), list, Token::Match(), Token::next(), Token::previous(), Token::scopeInfo(), Token::simpleMatch(), Token::str(), Token::strAt(), and Token::tokAt().
Referenced by TemplateSimplifier::simplifyTemplates().
|
private |
Check configuration (unknown macros etc)
Definition at line 8148 of file tokenize.cpp.
References Settings::checkConfiguration, Token::isControlFlowKeyword(), Token::link(), macroWithSemicolonError(), Token::Match(), mSettings, Token::next(), Token::str(), Token::tokAt(), and tokens().
Referenced by simplifyTokenList1().
|
private |
Definition at line 3469 of file tokenize.cpp.
References Token::findsimplematch(), TokenList::front(), Token::link(), list, Token::Match(), Token::next(), syntaxError(), and Token::tokAt().
Referenced by simplifyTokenList1().
|
private |
Definition at line 3500 of file tokenize.cpp.
References Token::deleteNext(), Token::deleteThis(), endsWith(), Token::findOpeningBracket(), TokenList::front(), isCPP(), Token::isName(), Token::isUpperCaseName(), list, Token::Match(), Token::next(), Token::originalName(), Token::previous(), Token::simpleMatch(), Token::str(), and Token::tokAt().
Referenced by simplifyTokenList1().
|
private |
Definition at line 3576 of file tokenize.cpp.
References Token::concatStr(), Token::deleteNext(), TokenList::front(), Token::isName(), isStringLiteral(), Platform::isWindows(), list, Token::Match(), mSettings, Token::next(), Settings::platform, simplifyString(), and Token::str().
Referenced by simplifyTokenList1().
|
private |
Definition at line 3599 of file tokenize.cpp.
References Token::deleteNext(), Token::eIncDecOp, TokenList::front(), list, Token::Match(), Token::next(), Token::str(), Token::tokAt(), and Token::tokType().
Referenced by simplifyTokenList1().
|
private |
Send error message to error logger about internal bug.
tok | the token that this bug concerns. |
Definition at line 8096 of file tokenize.cpp.
References InternalError::INTERNAL, and printDebugOutput().
Referenced by setVarIdPass1(), and validate().
|
private |
Setup links for tokens so that one can call Token::link().
Definition at line 5277 of file tokenize.cpp.
References TokenList::front(), linkBrackets(), list, Token::next(), and unmatchedToken().
Referenced by simplifyTokenList1().
|
private |
Setup links between < and >.
Definition at line 5311 of file tokenize.cpp.
References Token::createMutualLinks(), Token::eLogicalOp, Token::findClosingBracket(), TokenList::front(), Token::insertTokenBefore(), isC(), Token::isComparisonOp(), Token::link(), list, Token::Match(), Token::next(), Token::previous(), Token::str(), Token::strAt(), Token::tokAt(), and Token::tokType().
Referenced by simplifyTokenList1().
void Tokenizer::createSymbolDatabase | ( | ) |
Referenced by clangimport::parseClangAstDump(), and simplifyTokens1().
Definition at line 369 of file tokenize.cpp.
References Token::deleteNext(), Token::deleteThis(), Token::eraseTokens(), TokenList::front(), Token::linkAt(), list, Token::next(), Token::previous(), and Token::str().
Referenced by simplifyTypedefCpp().
void Tokenizer::dump | ( | std::ostream & | out | ) | const |
Definition at line 5931 of file tokenize.cpp.
References Token::astOperand1(), Token::astOperand2(), Token::astParent(), Settings::basePaths, bool_to_string(), Token::column(), ValueType::container, ValueType::dump(), TemplateSimplifier::dump(), Token::eChar, Token::eLogicalOp, Token::eString, Token::exprId(), TokenList::file(), TokenList::front(), Token::function(), Token::getMacroName(), Path::getRelativePath(), Token::getStrLength(), id_string(), Token::isArithmeticalOp(), Token::isAssignmentOp(), Token::isAtomic(), Token::isAttributeExport(), Token::isAttributeMaybeUnused(), Token::isAttributeUnused(), Token::isBoolean(), Token::isCast(), Token::isComparisonOp(), Token::isComplex(), Token::isExpandedMacro(), Token::isExternC(), MathLib::isFloat(), Token::isImplicitInt(), MathLib::isInt(), Token::isName(), Library::isnoreturn(), Token::isNumber(), Token::isOp(), Token::isRemovedVoidParameter(), Token::isRestrict(), Token::isSigned(), Token::isSplittedVarDeclComma(), Token::isSplittedVarDeclEq(), Token::isTemplateArg(), Token::isUnsigned(), Settings::library, Token::linenr(), Token::link(), list, Token::Match(), mDirectives, mSettings, mSymbolDatabase, mTemplateSimplifier, mTypedefInfo, Token::next(), Token::originalName(), Token::printValueFlow(), SymbolDatabase::printXml(), Token::scope(), Token::str(), Token::tokType(), ErrorLogger::toxml(), Token::type(), Token::values(), Token::valueType(), Token::variable(), and Token::varId().
Referenced by CppCheck::checkClang(), and CppCheck::checkFile().
|
private |
Definition at line 220 of file tokenize.cpp.
References Token::isCpp(), Token::link(), Token::linkAt(), Token::Match(), Token::next(), Token::previous(), Token::simpleMatch(), startsWith(), Token::str(), Token::strAt(), syntaxError(), and Token::tokAt().
Referenced by simplifyTypedefCpp().
|
private |
Simplify "if else".
Definition at line 7703 of file tokenize.cpp.
References Token::createMutualLinks(), TokenList::front(), Token::insertToken(), Token::link(), list, Token::Match(), Token::next(), Token::previous(), Token::str(), Token::strAt(), syntaxError(), and unknownMacroError().
Referenced by simplifyTokenList1().
|
private |
Definition at line 3482 of file tokenize.cpp.
References mSettings, mTypeSize, Settings::platform, Platform::sizeof_bool, Platform::sizeof_double, Platform::sizeof_float, Platform::sizeof_int, Platform::sizeof_long, Platform::sizeof_long_double, Platform::sizeof_long_long, Platform::sizeof_pointer, Platform::sizeof_short, Platform::sizeof_size_t, and Platform::sizeof_wchar_t.
Referenced by simplifyTokens1().
|
private |
Definition at line 3463 of file tokenize.cpp.
References TemplateSimplifier::checkComplicatedSyntaxErrorsInTemplates(), mTemplateSimplifier, and validate().
Referenced by simplifyTokenList1().
|
private |
Detect garbage code and call syntaxError() if found.
Referenced by simplifyTokenList1().
Find end of SQL (or PL/SQL) block.
Referenced by simplifySQL().
Get function token for a attribute.
|
inline |
Definition at line 615 of file tokenize.h.
Referenced by Summaries::create(), CTU::getFileInfo(), clangimport::parseClangAstDump(), Check64BitPortability::runChecks(), CheckAssert::runChecks(), CheckAutoVariables::runChecks(), CheckBool::runChecks(), CheckBoost::runChecks(), CheckBufferOverrun::runChecks(), CheckClass::runChecks(), CheckCondition::runChecks(), CheckExceptionSafety::runChecks(), CheckFunctions::runChecks(), CheckInternal::runChecks(), CheckIO::runChecks(), CheckLeakAutoVar::runChecks(), CheckMemoryLeakInFunction::runChecks(), CheckMemoryLeakInClass::runChecks(), CheckMemoryLeakStructMember::runChecks(), CheckMemoryLeakNoVar::runChecks(), CheckNullPointer::runChecks(), CheckOther::runChecks(), CheckPostfixOperator::runChecks(), CheckSizeof::runChecks(), CheckStl::runChecks(), CheckString::runChecks(), CheckType::runChecks(), CheckUninitVar::runChecks(), CheckUnusedVar::runChecks(), CheckVaarg::runChecks(), and setValues().
|
inline |
Definition at line 563 of file tokenize.h.
Referenced by CheckCondition::alwaysTrueFalse(), CheckBufferOverrun::argumentSize(), CheckNullPointer::arithmetic(), CheckBufferOverrun::arrayIndexThenCheck(), CheckAutoVariables::assignFunctionArg(), CheckAutoVariables::autoVariables(), CheckBufferOverrun::bufferOverflow(), CheckLeakAutoVar::check(), CheckMemoryLeakInClass::check(), CheckMemoryLeakStructMember::check(), CheckMemoryLeakNoVar::check(), CheckUninitVar::check(), CheckOther::checkAccessOfMovedVariable(), CheckBool::checkAssignBoolToFloat(), CheckBool::checkAssignBoolToPointer(), CheckCondition::checkAssignmentInCondition(), CheckBool::checkBitwiseOnBoolean(), CheckBoost::checkBoostForeachModification(), CheckOther::checkCastIntToCharAndBack(), CheckExceptionSafety::checkCatchExceptionByValue(), CheckOther::checkCharVariable(), CppCheck::checkClang(), CheckOther::checkComparePointers(), CheckCondition::checkCompareValueOutOfTypeRange(), CheckOther::checkComparisonFunctionIsAlwaysTrueOrFalse(), CheckBool::checkComparisonOfBoolExpressionWithInt(), CheckBool::checkComparisonOfBoolWithBool(), CheckBool::checkComparisonOfBoolWithInt(), CheckBool::checkComparisonOfFuncReturningBool(), CheckOther::checkConstVariable(), CheckIO::checkCoutCerrMisusage(), CheckStl::checkDereferenceInvalidIterator(), CheckOther::checkDuplicateBranch(), CheckCondition::checkDuplicateConditionalAssign(), CheckOther::checkDuplicateExpression(), CheckOther::checkEvaluationOrder(), CheckIO::checkFileUsage(), CheckStl::checkFindInsert(), CheckOther::checkFuncArgNamesDifferent(), CheckUnusedVar::checkFunctionVariableUsage(), CheckFunctions::checkIgnoredReturnValue(), CheckOther::checkIncompleteArrayFill(), CheckCondition::checkIncorrectLogicOperator(), CheckString::checkIncorrectStringCompare(), CheckBool::checkIncrementBoolean(), CheckOther::checkInvalidFree(), CheckOther::checkKnownArgument(), CheckOther::checkKnownPointerToBool(), CheckType::checkLongCast(), CheckFunctions::checkMathFunctions(), CheckFunctions::checkMissingReturn(), CheckOther::checkMisusedScopedObject(), CheckCondition::checkModuloAlwaysTrueFalse(), CheckStl::checkMutexes(), CheckOther::checkOverlappingWrite(), CheckOther::checkPassByReference(), CheckCondition::checkPointerAdditionResultNotNull(), CheckFunctions::checkProhibitedFunctions(), CheckMemoryLeakInFunction::checkReallocUsage(), CheckOther::checkRedundantAssignment(), CheckOther::checkRedundantCopy(), CheckExceptionSafety::checkRethrowCopy(), CheckOther::checkShadowVariables(), CheckOther::checkSignOfUnsignedVariable(), CheckSizeof::checkSizeofForArrayParameter(), CheckSizeof::checkSizeofForNumericParameter(), CheckSizeof::checkSizeofForPointerSize(), CheckUninitVar::checkStruct(), CheckUnusedVar::checkStructMemberUsage(), CheckOther::checkSuspiciousCaseInSwitch(), CheckOther::checkSuspiciousSemicolon(), CheckString::checkSuspiciousStringCompare(), CheckOther::checkUnreachableCode(), CheckOther::checkUnusedLabel(), CheckOther::checkVarFuncNullUB(), CheckOther::checkVariableScope(), CheckAutoVariables::checkVarLifetime(), CheckIO::checkWrongPrintfScanfArguments(), CheckOther::clarifyCalculation(), CheckCondition::clarifyCondition(), CheckOther::clarifyStatement(), Summaries::create(), CheckExceptionSafety::deallocThrow(), CheckExceptionSafety::destructors(), CheckCondition::duplicateCondition(), CheckStl::erase(), CheckStl::eraseIteratorOutOfBounds(), CTU::getFileInfo(), CheckClass::getFileInfo(), CTU::getUnsafeUsage(), CheckStl::if_find(), CheckStl::invalidContainer(), CheckFunctions::invalidFunctionUsage(), CheckOther::invalidPointerCast(), CheckIO::invalidScanf(), CheckStl::iterators(), CheckStl::knownEmptyContainer(), CheckFunctions::memsetInvalid2ndParam(), CheckFunctions::memsetZeroBytes(), CheckStl::mismatchingContainerIterator(), CheckStl::mismatchingContainers(), CheckStl::missingComparison(), CheckCondition::multiCondition(), CheckCondition::multiCondition2(), CheckBufferOverrun::negativeArraySize(), CheckStl::negativeIndex(), CheckExceptionSafety::nothrowThrows(), CheckNullPointer::nullConstantDereference(), CheckBufferOverrun::objectIndex(), CheckStl::outOfBounds(), CheckStl::outOfBoundsIndexExpression(), CheckString::overlappingStrcmp(), clangimport::parseClangAstDump(), CheckUnusedFunctions::parseTokens(), CheckBool::pointerArithBool(), Check64BitPortability::pointerassignment(), CheckPostfixOperator::postfixOperator(), CheckOther::redundantBitwiseOperationInSwitchError(), CheckStl::redundantCondition(), CheckLeakAutoVar::ret(), CheckExceptionSafety::rethrowNoCurrentException(), CheckFunctions::returnLocalStdMove(), CheckBool::returnValueOfFunctionReturningBool(), CheckStl::size(), CheckString::sprintfOverlappingData(), CheckStl::stlBoundaries(), CheckStl::stlOutOfBounds(), CheckStl::string_c_str(), CheckString::stringLiteralWrite(), CheckBufferOverrun::stringNotZeroTerminated(), CheckString::strPlusChar(), CheckExceptionSafety::unhandledExceptionSpecification(), CheckStl::uselessCalls(), CheckFunctions::useStandardLibrary(), CheckStl::useStlAlgorithm(), CheckVaarg::va_list_usage(), CheckVaarg::va_start_argument(), CheckUninitVar::valueFlowUninit(), and CheckOther::warningOldStylePointerCast().
Definition at line 7658 of file tokenize.cpp.
References Token::deleteThis(), Token::insertToken(), Token::isNumber(), Token::isStandardType(), Token::link(), Token::Match(), Token::next(), Token::str(), Token::strAt(), Token::tokAt(), and Token::varId().
Referenced by simplifyInitVar().
|
inline |
Is the code C.
Used for bailouts
Definition at line 64 of file tokenize.h.
Referenced by CheckOther::checkConstVariable(), CheckIO::checkCoutCerrMisusage(), CheckUnusedVar::checkFunctionVariableUsage_iterateScopes(), CheckFunctions::checkMathFunctions(), CheckFunctions::checkMissingReturn(), CheckOther::checkMisusedScopedObject(), CheckOther::checkPassByReference(), CheckFunctions::checkProhibitedFunctions(), CheckOther::checkRedundantCopy(), CheckUninitVar::checkStruct(), CheckMemoryLeakStructMember::checkStructVariable(), CheckOther::checkVariableScope(), createLinks2(), SymbolDatabase::createSymbolDatabaseClassInfo(), SymbolDatabase::createSymbolDatabaseNeedInitialization(), markCppCasts(), removePragma(), CheckClass::runChecks(), CheckExceptionSafety::runChecks(), CheckPostfixOperator::runChecks(), setVarIdPass1(), setVarIdPass2(), simplifyCAlternativeTokens(), simplifyEmptyNamespaces(), simplifyExternC(), simplifyInitVar(), simplifyPointerToStandardType(), simplifyTemplates(), simplifyTokenList1(), simplifyTypedefCpp(), and simplifyVarDecl().
|
inline |
Is the code CPP.
Used for bailouts
Definition at line 69 of file tokenize.h.
Referenced by addSemicolonAfterUnknownMacro(), CheckOther::checkAccessOfMovedVariable(), CheckBool::checkAssignBoolToFloat(), CheckBool::checkComparisonOfBoolWithBool(), CheckBool::checkComparisonOfBoolWithInt(), CheckBool::checkComparisonOfFuncReturningBool(), CheckOther::checkEvaluationOrder(), CheckIO::checkFormatString(), CheckMemoryLeakNoVar::checkForUnsafeArgAlloc(), CheckUnusedVar::checkFunctionVariableUsage(), CheckFunctions::checkMathFunctions(), CheckUninitVar::checkScope(), CheckUninitVar::checkScopeForVariable(), combineOperators(), CheckClass::getFileInfo(), removeExtraTemplateKeywords(), removePragma(), reportUnknownMacros(), CheckFunctions::returnLocalStdMove(), CheckBoost::runChecks(), CheckMemoryLeakInClass::runChecks(), CheckStl::runChecks(), setVarIdPass1(), simplifyIfSwitchForInit(), simplifyLabelsCaseDefault(), simplifyRedundantParentheses(), simplifyStaticConst(), simplifyTokenList1(), simplifyUsing(), simplifyUsingToTypedef(), simplifyVarDecl(), CheckType::tooBigSignedBitwiseShiftError(), validateC(), and CheckOther::warningOldStylePointerCast().
is token pointing at function head?
tok | A '(' or ')' token in a possible function head |
endsWith | string after function head |
Definition at line 97 of file tokenize.cpp.
References endsWith(), Token::isCpp(), Token::isUpperCaseName(), Token::link(), Token::linkAt(), Token::Match(), Token::next(), Token::originalName(), Token::str(), and Token::tokAt().
Referenced by SymbolDatabase::addClassFunction(), SymbolDatabase::createSymbolDatabaseFindAllScopes(), TemplateSimplifier::expandTemplate(), Function::Function(), TemplateSimplifier::getTemplateNamePositionTemplateFunction(), SymbolDatabase::isFunction(), isMemberFunction(), removeMacrosInGlobalScope(), setVarIdPass1(), setVarIdPass2(), setVarIdStructMembers(), simplifyCAlternativeTokens(), simplifyTypedefCpp(), and startOfExecutableScope().
|
staticprivate |
Detect garbage expression.
|
staticprivate |
Definition at line 2812 of file tokenize.cpp.
References isFunctionHead(), Token::Match(), and Token::tokAt().
Referenced by simplifyUsing().
|
static |
Helper function to check whether number is one (1 or 0.1E+1 or 1E+0) or not?
s | the string to check |
Definition at line 8141 of file tokenize.cpp.
References isNumberOneOf(), and MathLib::isPositive().
Referenced by CheckFunctions::checkMathFunctions().
bool Tokenizer::isPacked | ( | const Token * | bodyStart | ) | const |
Referenced by CheckUnusedVar::checkStructMemberUsage().
bool Tokenizer::isScopeNoReturn | ( | const Token * | endScopeToken, |
bool * | unknown = nullptr |
||
) | const |
Check if inner scope ends with a call to a noreturn function.
endScopeToken | The '}' token |
unknown | set to true if it's unknown if the scope is noreturn |
Definition at line 8021 of file tokenize.cpp.
References Settings::checkLibrary, Token::function(), information, Library::isScopeNoReturn(), Settings::library, Token::linkAt(), mSettings, Token::previous(), reportError(), Token::simpleMatch(), Settings::summaryReturn, Token::tokAt(), Token::type(), and Token::variable().
Referenced by CheckMemoryLeakInFunction::checkReallocUsage(), CheckLeakAutoVar::checkScope(), and CheckUninitVar::checkScopeForVariable().
|
private |
Definition at line 8088 of file tokenize.cpp.
References information, and reportError().
Referenced by checkConfiguration().
|
private |
Set isCast() for C++ casts.
Definition at line 5429 of file tokenize.cpp.
References TokenList::front(), isC(), Token::isCast(), Token::linkAt(), list, Token::Match(), Token::next(), Token::simpleMatch(), and syntaxError().
Referenced by simplifyTokenList1().
|
inlineprivate |
Get new variable id.
Definition at line 637 of file tokenize.h.
Referenced by SymbolDatabase::fixVarId().
|
staticprivate |
|
private |
Prepare ternary operators with parentheses so that the AST can be created.
Referenced by simplifyTokenList1().
void Tokenizer::printDebugOutput | ( | int | simplification | ) | const |
print –debug output if debug flags match the simplification: 0=unknown/both simplifications 1=1st simplifications 2=2nd simplifications
Definition at line 5881 of file tokenize.cpp.
References debug, Settings::debugnormal, Settings::debugSimplified, Settings::debugwarnings, TokenList::front(), TokenList::getFiles(), list, mSettings, mSymbolDatabase, Token::next(), Token::printAst(), SymbolDatabase::printOut(), Token::printOut(), printUnknownTypes(), Token::printValueFlow(), SymbolDatabase::printXml(), reportError(), SymbolDatabase::variableList(), Settings::verbose, and Settings::xml.
Referenced by CppCheck::checkClang(), cppcheckError(), simplifyTokens1(), syntaxError(), syntaxErrorC(), unknownMacroError(), and unmatchedToken().
|
private |
Output list of unknown types.
Referenced by printDebugOutput().
Definition at line 481 of file tokenize.cpp.
References Token::link(), Token::linkAt(), Token::Match(), Token::next(), Token::simpleMatch(), Token::str(), syntaxError(), and Token::tokAt().
Referenced by processFunc(), and simplifyTypedefCpp().
Definition at line 541 of file tokenize.cpp.
References processFunc().
|
private |
Remove extra "template" keywords that are not used by Cppcheck.
Definition at line 6306 of file tokenize.cpp.
References Token::deleteNext(), TokenList::front(), isCPP(), Token::isTemplate(), Token::link(), list, Token::Match(), Token::next(), Token::previous(), Token::str(), syntaxError(), and Token::tokAt().
Referenced by simplifyTokenList1().
|
private |
Remove undefined macro in class definition: class DLLEXPORT Fred { }; class Fred FINAL : Base { };.
Definition at line 6487 of file tokenize.cpp.
References Token::deleteNext(), TokenList::front(), Token::isUpperCaseName(), list, Token::Match(), Token::next(), and Token::tokAt().
Referenced by simplifyTokenList1().
|
private |
Remove macros in global scope.
Definition at line 6392 of file tokenize.cpp.
References Token::deleteNext(), Token::deleteThis(), endsWith(), Token::eraseTokens(), TokenList::front(), isFunctionHead(), Token::isKeyword(), Token::isName(), Token::isStandardType(), Token::isUpperCaseName(), Token::link(), Token::linkAt(), list, Token::Match(), Token::next(), Token::previous(), Token::str(), Token::strAt(), Token::tokAt(), and unknownMacroError().
Referenced by simplifyTokenList1().
|
private |
Definition at line 6471 of file tokenize.cpp.
References Standards::c, Standards::C89, Standards::cpp, Standards::CPP03, Token::deleteThis(), Token::eraseTokens(), TokenList::front(), isC(), isCPP(), Token::linkAt(), list, mSettings, Token::next(), Token::simpleMatch(), and Settings::standards.
Referenced by simplifyTokenList1().
|
private |
Reduces "; ;" to ";", except in "( ; ; )".
Definition at line 6561 of file tokenize.cpp.
References Token::deleteNext(), TokenList::front(), Token::link(), list, Token::next(), Token::simpleMatch(), and Token::str().
Referenced by simplifyTokenList1().
|
private |
Remove unnecessary member qualification.
Referenced by simplifyTokenList1().
|
private |
|
private |
report error message
Referenced by isScopeNoReturn(), macroWithSemicolonError(), printDebugOutput(), simplifyTypedef(), simplifyUsing(), splitTemplateRightAngleBrackets(), unhandled_macro_class_x_y(), unhandledCharLiteral(), and unsupportedTypedef().
|
private |
Detect unknown macros and throw unknownMacro.
Definition at line 8290 of file tokenize.cpp.
References cAlternativeTokens, isCPP(), Token::isKeyword(), Token::isName(), isNonMacro(), Token::isStandardType(), Token::isUpperCaseName(), Token::link(), Token::linkAt(), Token::Match(), Token::next(), Token::previous(), Token::simpleMatch(), startsWith(), Token::str(), Token::strAt(), Token::tokAt(), tokens(), and unknownMacroError().
Referenced by simplifyTokenList1().
void Tokenizer::setDirectives | ( | std::list< Directive > | directives | ) |
Referenced by CppCheck::checkFile().
|
private |
Set pod types.
Referenced by setVarId().
|
inline |
Definition at line 59 of file tokenize.h.
Referenced by CppCheck::checkFile().
|
private |
Set variable id.
Definition at line 4502 of file tokenize.cpp.
References TokenList::front(), Token::isName(), list, Token::next(), setPodTypes(), setVarIdPass1(), setVarIdPass2(), and Token::varId().
Referenced by simplifyTokenList1().
|
staticprivate |
Definition at line 4471 of file tokenize.cpp.
References Token::isName(), Token::Match(), Token::next(), setVarIdStructMembers(), Token::simpleMatch(), Token::str(), Token::tokAt(), and Token::varId().
Referenced by setVarIdPass2().
|
private |
Definition at line 4525 of file tokenize.cpp.
References Standards::cpp, Standards::CPP17, cppcheckError(), endsWith(), Token::findClosingBracket(), Token::findsimplematch(), TokenList::front(), isC(), isClassStructUnionEnumStart(), Token::isCpp(), isCPP(), isEnumStart(), isFunctionHead(), Token::isKeyword(), Token::isLiteral(), Token::isName(), Token::isOp(), Token::isOperatorKeyword(), Token::isStandardType(), Token::link(), Token::linkAt(), list, Token::Match(), mSettings, mVarId, Token::next(), Token::nextArgumentBeforeCreateLinks2(), notstart_c, notstart_cpp, Token::previous(), setVarIdClassDeclaration(), setVarIdParseDeclaration(), setVarIdStructMembers(), Token::simpleMatch(), Settings::standards, Token::str(), Token::strAt(), syntaxError(), syntaxErrorC(), Settings::terminated(), Token::tokAt(), and Token::varId().
Referenced by setVarId().
|
private |
Definition at line 5011 of file tokenize.cpp.
References Token::eBoolean, Token::eKeyword, Token::findClosingBracket(), TokenList::front(), getScopeName(), isC(), isFunctionHead(), Token::isLiteral(), Token::isName(), Token::isStandardType(), Token::link(), Token::linkAt(), list, Token::Match(), matchMemberFunctionName(), matchMemberVarName(), mVarId, Token::next(), Token::previous(), setVarIdClassFunction(), Token::simpleMatch(), skipInitializerList(), Token::str(), Token::strAt(), syntaxError(), Token::tokAt(), Token::tokType(), and Token::varId().
Referenced by setVarId().
|
private |
Add braces to an if-block, for-block, etc.
Definition at line 6581 of file tokenize.cpp.
References TokenList::front(), list, Token::next(), and simplifyAddBracesToCommand().
Referenced by simplifyTokenList1().
Add pair of braces to an single if-block, else-block, for-block, etc.
for command starting at token
Definition at line 6635 of file tokenize.cpp.
References Token::createMutualLinks(), Token::eBracket, Token::insertToken(), Token::isUpperCaseName(), Token::link(), Token::linkAt(), Token::Match(), Token::move(), Token::next(), Token::previous(), Token::simpleMatch(), simplifyAddBracesToCommand(), skipCaseLabel(), Token::str(), Token::strAt(), syntaxError(), Token::tokAt(), Token::tokType(), and unknownMacroError().
Referenced by simplifyAddBracesToCommand().
Add braces to an if-block, for-block, etc.
for command starting at token including else-block
Definition at line 6591 of file tokenize.cpp.
References Token::link(), Token::Match(), Token::next(), Token::previous(), Token::simpleMatch(), simplifyAddBracesPair(), Token::str(), Token::strAt(), syntaxError(), and Token::tokAt().
Referenced by simplifyAddBraces(), and simplifyAddBracesPair().
|
private |
Definition at line 3689 of file tokenize.cpp.
References TokenList::front(), Token::isNumber(), list, Token::Match(), Token::next(), Token::str(), Token::tokAt(), and Token::varId().
Referenced by simplifyTokenList1().
|
private |
Remove __asm.
Referenced by simplifyTokenList1().
|
private |
asm heuristics, Put ^{} statements in asm()
Referenced by simplifyTokenList1().
|
private |
Simplify assignment where rhs is a block : "x=({123;});" => "{x=123;}".
Referenced by simplifyTokenList1().
|
private |
Simplify @… (compiler extension)
Referenced by simplifyTokenList1().
|
private |
Remove __attribute__ ((?))
Referenced by simplifyTokenList1().
|
private |
Simplify bitfields - the field width is removed as we don't use it.
Referenced by simplifyTokenList1().
|
private |
Remove Borland code.
Referenced by simplifyTokenList1().
|
private |
Remove calling convention.
Referenced by simplifyTokenList1().
|
private |
Simplify the 'C Alternative Tokens' Examples: "if(s and t)" => "if(s && t)" "while((r bitand s) and not t)" => while((r & s) && !t)" "a and_eq b;" => "a &= b;".
Definition at line 7537 of file tokenize.cpp.
References cAlternativeTokens, TokenList::front(), isC(), isFunctionHead(), Token::isName(), list, Token::Match(), Token::next(), Token::previous(), Token::str(), and Token::strAt().
Referenced by simplifyTokenList1().
|
private |
simplify case ranges (gcc extension)
Definition at line 3994 of file tokenize.cpp.
References TokenList::front(), Token::insertToken(), list, Token::Match(), Token::next(), Token::str(), Token::strAt(), MathLib::toBigNumber(), and Token::tokAt().
Referenced by simplifyTokenList1().
|
private |
Simplify coroutines - just put parentheses around arguments for co_* keywords so they can be handled like function calls in data flow.
Referenced by simplifyTokenList1().
|
private |
Remove [[attribute]] (C++11, C23) from TokenList.
Referenced by simplifyTokenList1().
|
private |
Remove __cppcheck__ ((?))
Referenced by simplifyTokenList1().
|
private |
Referenced by simplifyTokenList1().
|
private |
Remove __declspec()
Referenced by simplifyTokenList1().
|
private |
Definition at line 3728 of file tokenize.cpp.
References Token::deleteNext(), TokenList::front(), Token::isNumber(), list, Token::next(), Token::previous(), and Token::str().
Referenced by simplifyTokenList1().
|
private |
Simplify useless C++ empty namespaces, like: 'namespace name% { }'.
Definition at line 6522 of file tokenize.cpp.
References Token::deleteNext(), Token::deleteThis(), TokenList::front(), isC(), Token::link(), list, Token::Match(), Token::next(), Token::previous(), Token::str(), Token::strAt(), and Token::tokAt().
Referenced by simplifyTokenList1().
|
private |
Definition at line 3615 of file tokenize.cpp.
References Token::deleteNext(), Token::deleteThis(), TokenList::front(), isC(), Token::isExternC(), Token::linkAt(), list, Token::Match(), Token::next(), Token::str(), and Token::strAt().
Referenced by simplifyTokenList1().
|
private |
Simplify functions like "void f(x) int x; {" into "void f(int x) {".
Definition at line 6734 of file tokenize.cpp.
References Token::deleteNext(), TokenList::front(), Token::insertToken(), Token::isName(), Token::linenr(), Token::link(), list, Token::Match(), Token::next(), Token::previous(), Token::replace(), Token::simpleMatch(), Token::str(), Token::strAt(), syntaxError(), and Token::tokAt().
Referenced by simplifyTokenList1().
|
private |
Simplify function pointers.
Definition at line 6928 of file tokenize.cpp.
References Token::deleteNext(), Token::deleteThis(), Token::eraseTokens(), TokenList::front(), indent(), Token::isCpp(), Token::isName(), Token::link(), Token::linkAt(), list, Token::Match(), Token::next(), Token::previous(), Token::simpleMatch(), Token::str(), syntaxError(), and Token::tokAt().
Referenced by simplifyTokenList1().
|
private |
Simplify function level try blocks: Convert "void f() try {} catch (int) {}" to "void f() { try {} catch (int) {} }".
Referenced by simplifyTokenList1().
|
private |
If –check-headers=no has been given; then remove unneeded code in headers.
Definition at line 6181 of file tokenize.cpp.
References Settings::checkHeaders, Settings::checkUnusedTemplates, Token::deleteThis(), Token::eraseTokens(), Token::fileIndex(), Token::findClosingBracket(), TokenList::front(), Token::isCpp(), Token::isKeyword(), Token::isName(), Token::link(), Token::linkAt(), list, Token::Match(), mSettings, Token::next(), Token::previous(), Token::simpleMatch(), Token::str(), Token::strAt(), and Token::tokAt().
Referenced by simplifyTokenList1().
|
private |
Simplify C++17/C++20 if/switch/for initialization expression.
Definition at line 7735 of file tokenize.cpp.
References Standards::cpp, Standards::CPP17, Standards::CPP20, Token::createMutualLinks(), Token::deleteNext(), TokenList::front(), Token::insertToken(), isCPP(), Token::isSimplifiedScope(), Token::link(), Token::linkAt(), list, Token::Match(), mSettings, Token::next(), Token::simpleMatch(), Settings::standards, Token::str(), and Token::tokAt().
Referenced by simplifyTokenList1().
|
private |
Simplify variable initialization '; int *p(0);' => '; int *p = 0;'.
Definition at line 7625 of file tokenize.cpp.
References TokenList::front(), initVar(), TokenList::insertTokens(), isC(), Token::isName(), Token::link(), Token::linkAt(), list, Token::Match(), Token::next(), Token::previous(), Token::simpleMatch(), Token::str(), and Token::tokAt().
Referenced by simplifyTokenList1().
|
private |
Remove keywords "volatile", "inline", "register", and "restrict".
Referenced by simplifyTokenList1().
|
private |
Simplify labels and 'case|default' syntaxes.
simplify labels and case|default in the code: add a ";" if not already in.
Definition at line 3944 of file tokenize.cpp.
References TokenList::front(), Token::insertToken(), isCPP(), Token::link(), list, Token::Match(), Token::next(), Token::previous(), skipCaseLabel(), startOfExecutableScope(), Token::str(), Token::strAt(), syntaxError(), and Token::tokAt().
Referenced by simplifyTokenList1().
|
private |
Convert Microsoft memory functions CopyMemory(dst, src, len) -> memcpy(dst, src, len) FillMemory(dst, len, val) -> memset(dst, val, len) MoveMemory(dst, src, len) -> memmove(dst, src, len) ZeroMemory(dst, len) -> memset(dst, 0, len)
Referenced by simplifyTokenList1().
|
private |
Convert Microsoft string functions _tcscpy -> strcpy.
Referenced by simplifyTokenList1().
|
private |
Convert namespace aliases.
Referenced by simplifyTokenList1().
|
private |
Add std:: in front of std classes, when using namespace std; was given.
Referenced by simplifyTokenList1().
|
private |
Convert C++17 style nested namespace to older style.
Referenced by simplifyTokenList1().
|
private |
Collapse operator name tokens into single token operator = => operator=.
Referenced by simplifyTokenList1().
|
private |
simplify overloaded operators: 'obj(123)' => 'obj .
operator() ( 123 )'
Referenced by simplifyTokenList1().
|
private |
Definition at line 3703 of file tokenize.cpp.
References Token::deleteNext(), TokenList::front(), list, Token::Match(), Token::next(), and Token::setRemovedVoidParameter().
Referenced by simplifyTokenList1().
|
private |
Simplify pointer to standard type (C only)
Definition at line 6906 of file tokenize.cpp.
References Token::deleteNext(), Token::eraseTokens(), TokenList::front(), isC(), list, Token::Match(), Token::next(), Token::previous(), and Token::tokAt().
Referenced by simplifyTokenList1().
|
private |
Definition at line 3713 of file tokenize.cpp.
References Token::deleteNext(), TokenList::front(), Token::link(), Token::linkAt(), list, Token::next(), and Token::simpleMatch().
Referenced by simplifyTokenList1().
|
private |
Remove redundant parentheses:
Definition at line 7796 of file tokenize.cpp.
References Token::deleteNext(), Token::deleteThis(), Token::findsimplematch(), TokenList::front(), Token::isCpp(), isCPP(), Token::isKeyword(), Token::isStandardType(), Token::link(), Token::linkAt(), list, Token::Match(), Token::next(), Token::previous(), Token::simpleMatch(), Token::str(), Token::strAt(), Token::tokAt(), and Token::varId().
Referenced by simplifyTokenList1().
|
private |
Definition at line 3641 of file tokenize.cpp.
References Token::deleteNext(), Token::deleteThis(), TokenList::front(), Token::linkAt(), list, Token::Match(), Token::next(), Token::previous(), Token::simpleMatch(), Token::str(), and Token::tokAt().
Referenced by simplifyTokenList1().
|
private |
Simplify c++20 spaceship operator.
Referenced by simplifyTokenList1().
|
private |
Definition at line 3662 of file tokenize.cpp.
References Token::eraseTokens(), findSQLBlockEnd(), TokenList::front(), Token::insertToken(), list, Token::next(), Token::simpleMatch(), Token::str(), Token::stringifyList(), syntaxError(), and Token::tokAt().
Referenced by simplifyTokenList1().
|
private |
Simplify the location of "static" and "const" qualifiers in a variable declaration or definition.
Example: "int static const a;" => "static const a;" Example: "long long const static b;" => "static const long long b;"
Definition at line 7413 of file tokenize.cpp.
References Token::deleteNext(), Token::findOpeningBracket(), TokenList::front(), Token::insertToken(), Token::insertTokenBefore(), isCPP(), list, Token::Match(), Token::next(), Token::previous(), Token::simpleMatch(), Token::str(), and Token::swapWithNext().
Referenced by simplifyTokenList1().
|
staticprivate |
Modify strings in the token list by replacing hex and oct values.
E.g. "\x61" -> "a" and "\000" -> "\0"
source | The string to be modified, e.g. "\x61" |
Referenced by combineStringAndCharLiterals().
|
private |
Struct simplification "struct S { } s;" => "struct S { }; S s;".
Referenced by simplifyTokenList1().
|
private |
Simplify templates.
Definition at line 4106 of file tokenize.cpp.
References isC(), mSettings, mTemplateSimplifier, TemplateSimplifier::simplifyTemplates(), and Settings::templateMaxTime.
Referenced by simplifyTokenList1().
|
private |
Basic simplification of tokenlist.
FileName | The filename to run; used to do markup checks. |
Definition at line 5468 of file tokenize.cpp.
References addSemicolonAfterUnknownMacro(), arraySize(), Token::assignIndexes(), Token::assignProgressValues(), checkConfiguration(), checkForEnumsWithTypedef(), combineOperators(), combineStringAndCharLiterals(), concatenateNegativeNumberAndAnyPositive(), createLinks(), createLinks2(), Settings::daca, Token::deleteNext(), elseif(), findComplicatedSyntaxErrorsInTemplates(), findGarbageCode(), TokenList::front(), information, isC(), Token::isConstexpr(), isCPP(), SimpleEnableGroup< T >::isEnabled(), Token::isNumber(), Token::isUpperCaseName(), Settings::library, Token::link(), Token::linkAt(), list, markCppCasts(), Library::markupFile(), Token::Match(), mSettings, mTimerResults, Token::next(), prepareTernaryOpForAST(), removeExtraTemplateKeywords(), removeMacroInClassDef(), removeMacrosInGlobalScope(), removePragma(), removeRedundantSemicolons(), removeUnnecessaryQualification(), reportUnknownMacros(), setVarId(), Settings::severity, Settings::showtime, Token::simpleMatch(), simplifyAddBraces(), simplifyArrayAccessSyntax(), simplifyAsm(), simplifyAsm2(), simplifyAssignmentBlock(), simplifyAt(), simplifyAttribute(), simplifyBitfields(), simplifyBorland(), simplifyCallingConvention(), simplifyCAlternativeTokens(), simplifyCaseRange(), simplifyCoroutines(), simplifyCPPAttribute(), simplifyCppcheckAttribute(), simplifyDebug(), simplifyDeclspec(), simplifyDoublePlusAndDoubleMinus(), simplifyEmptyNamespaces(), simplifyExternC(), simplifyFunctionParameters(), simplifyFunctionPointers(), simplifyFunctionTryCatch(), simplifyHeadersAndUnusedTemplates(), simplifyIfSwitchForInit(), simplifyInitVar(), simplifyKeyword(), simplifyLabelsCaseDefault(), simplifyMicrosoftMemoryFunctions(), simplifyMicrosoftStringFunctions(), simplifyNamespaceAliases(), simplifyNamespaceStd(), simplifyNestedNamespace(), TemplateSimplifier::simplifyNumericCalculations(), simplifyOperatorName(), simplifyOverloadedOperators(), simplifyParameterVoid(), TokenList::simplifyPlatformTypes(), simplifyPointerToStandardType(), simplifyRedundantConsecutiveBraces(), simplifyRedundantParentheses(), simplifyRoundCurlyParentheses(), simplifySpaceshipOperator(), simplifySQL(), simplifyStaticConst(), TokenList::simplifyStdType(), simplifyStructDecl(), simplifyTemplates(), simplifyTypedef(), simplifyTypedefLHS(), simplifyTypeIntrinsics(), simplifyUsing(), simplifyVarDecl(), simplifyVariableMultipleAssign(), sizeofAddParentheses(), splitTemplateRightAngleBrackets(), Token::str(), Token::strAt(), syntaxError(), Settings::terminated(), unhandled_macro_class_x_y(), validate(), and validateC().
Referenced by simplifyTokens1().
bool Tokenizer::simplifyTokens1 | ( | const std::string & | configuration | ) |
Definition at line 3380 of file tokenize.cpp.
References arraySizeAfterValueFlow(), Settings::buildDir, Summaries::create(), TokenList::createAst(), createSymbolDatabase(), Settings::debugnormal, Token::eChar, fillTypeSizes(), TokenList::getFiles(), SimpleEnableGroup< T >::isEnabled(), list, mConfiguration, mErrorLogger, mSettings, mSymbolDatabase, mTimerResults, Token::next(), portability, printDebugOutput(), SymbolDatabase::setArrayDimensionsUsingValueFlow(), ValueFlow::setValues(), SymbolDatabase::setValueTypeInTokenList(), Settings::severity, Settings::showtime, simplifyTokenList1(), Token::str(), tokens(), Token::tokType(), unhandledCharLiteral(), TokenList::validateAst(), and Token::values().
Referenced by CppCheck::checkFile().
|
private |
typedef A mytype; mytype c;
Becomes: typedef A mytype; A c;
Definition at line 1054 of file tokenize.cpp.
References Token::column(), Tokenizer::TypedefInfo::column, Token::deleteThis(), TokenList::file(), Tokenizer::TypedefInfo::filename, TokenList::front(), SimpleEnableGroup< T >::isEnabled(), Token::isName(), Token::linenr(), Tokenizer::TypedefInfo::lineNumber, Token::link(), list, Token::Match(), mSettings, mTypedefInfo, Tokenizer::TypedefInfo::name, Token::next(), portability, Token::replace(), reportError(), Settings::severity, simplifyTypedefCpp(), Token::str(), and Tokenizer::TypedefInfo::used.
Referenced by simplifyTokenList1().
|
private |
Definition at line 1147 of file tokenize.cpp.
References Token::column(), Tokenizer::TypedefInfo::column, TokenList::copyTokens(), Token::createMutualLinks(), debug, Settings::debugwarnings, deleteInvalidTypedef(), Token::deleteNext(), Token::deletePrevious(), Token::deleteThis(), done, duplicateTypedef(), emptyString, Token::eraseTokens(), TokenList::file(), Tokenizer::TypedefInfo::filename, Token::findClosingBracket(), TokenList::front(), TokenList::getFiles(), Token::insertToken(), isC(), Token::isControlFlowKeyword(), Token::isCpp(), isEnumScope(), Token::isExpandedMacro(), isFunctionHead(), Token::isInline(), Token::isKeyword(), Token::isName(), Token::isNameOnly(), Token::isSimplifiedTypedef(), Token::isStandardType(), Token::linenr(), Tokenizer::TypedefInfo::lineNumber, Token::link(), Token::linkAt(), list, Token::Match(), mErrorLogger, mSettings, mTypedefInfo, mUnnamedCount, Tokenizer::TypedefInfo::name, Token::next(), normal, Token::previous(), processFunc(), Token::progressValue(), ErrorLogger::reportErr(), ErrorLogger::reportProgress(), Token::simpleMatch(), simplifyUsingToTypedef(), splitDefinitionFromTypedef(), Token::str(), Token::strAt(), syntaxError(), Settings::terminated(), Token::tokAt(), Settings::typedefMaxTime, unsupportedTypedef(), and Tokenizer::TypedefInfo::used.
Referenced by simplifyTypedef().
|
private |
Move typedef token to the left og the expression.
Definition at line 569 of file tokenize.cpp.
References Token::deleteThis(), TokenList::front(), Token::insertTokenBefore(), Token::linkAt(), list, Token::Match(), Token::next(), Token::previous(), and Token::simpleMatch().
Referenced by simplifyTokenList1().
|
private |
Definition at line 7965 of file tokenize.cpp.
References Token::createMutualLinks(), TokenList::front(), Token::insertToken(), Token::link(), list, Token::Match(), Token::next(), Token::previous(), Token::str(), and Token::tokAt().
Referenced by simplifyTokenList1().
|
private |
Definition at line 2856 of file tokenize.cpp.
References TokenList::copyTokens(), Standards::cpp, Standards::CPP11, debug, Settings::debugwarnings, Token::deletePrevious(), Token::deleteThis(), emptyString, Token::eraseTokens(), Token::findClosingBracket(), TemplateSimplifier::findTemplateDeclarationEnd(), TokenList::front(), TokenList::getFiles(), Token::insertToken(), isCPP(), Token::isKeyword(), Token::isLiteral(), isMemberFunction(), Token::isNameOnly(), Token::isSimplifiedTypedef(), Token::isStandardType(), Token::link(), Token::linkAt(), list, Token::Match(), mErrorLogger, mSettings, mUnnamedCount, Token::next(), Token::previous(), Token::progressValue(), reportError(), ErrorLogger::reportProgress(), scopesMatch(), Token::simpleMatch(), simplifyUsingError(), Settings::standards, Token::str(), Token::strAt(), syntaxError(), Settings::terminated(), Token::tokAt(), and tokDistance().
Referenced by TemplateSimplifier::simplifyTemplates(), and simplifyTokenList1().
Definition at line 3364 of file tokenize.cpp.
References debug, Settings::debugwarnings, list, mErrorLogger, mSettings, Token::next(), normal, ErrorLogger::reportErr(), and Token::str().
Referenced by simplifyUsing().
|
private |
Definition at line 546 of file tokenize.cpp.
References Standards::cpp, Standards::CPP11, TokenList::front(), Token::insertToken(), isCPP(), list, Token::Match(), mSettings, Token::next(), Token::previous(), Settings::standards, Token::str(), and Token::tokAt().
Referenced by simplifyTypedefCpp().
|
private |
Simplify variable declarations (split up)
only_k_r_fpar | Only simplify K&R function parameters |
Definition at line 7049 of file tokenize.cpp.
References TokenList::front(), and list.
Referenced by simplifyTokenList1(), and simplifyVarDecl().
|
private |
Definition at line 7054 of file tokenize.cpp.
References Standards::cpp, Standards::CPP11, Token::findClosingBracket(), findLambdaEndScope(), Token::getMacroName(), Token::insertToken(), TokenList::insertTokens(), isC(), Token::isCpp(), isCPP(), Token::isName(), Token::isSplittedVarDeclComma(), Token::isSplittedVarDeclEq(), Token::link(), Token::linkAt(), Token::Match(), mSettings, Token::next(), Token::previous(), Token::setMacroName(), Token::simpleMatch(), simplifyVarDecl(), Settings::standards, Token::str(), Token::strAt(), syntaxError(), TemplateSimplifier::templateParameters(), Token::tokAt(), and Token::varId().
|
private |
Simplify multiple assignments.
Example: "a = b = c = 0;" => "a = 0; b = 0; c = 0;"
Definition at line 7482 of file tokenize.cpp.
References TokenList::front(), Token::insertToken(), list, Token::Match(), Token::next(), Token::previous(), Token::str(), and Token::tokAt().
Referenced by simplifyTokenList1().
|
private |
Add parentheses for sizeof: sizeof x => sizeof(x)
Definition at line 5444 of file tokenize.cpp.
References Token::createMutualLinks(), TokenList::front(), Token::insertToken(), Token::isLiteral(), Token::linkAt(), list, Token::Match(), Token::next(), and Token::simpleMatch().
Referenced by simplifyTokenList1().
nonneg int Tokenizer::sizeOfType | ( | const std::string & | type | ) | const |
Definition at line 179 of file tokenize.cpp.
References Settings::library, mSettings, mTypeSize, Library::podtype(), and Library::PodType::size.
Calculates sizeof value for given type.
type | Token which will contain e.g. "int", "*", or string. |
Definition at line 192 of file tokenize.cpp.
References Token::eString, Token::getStrLength(), Token::isLong(), Settings::library, mSettings, mTypeSize, Settings::platform, Library::podtype(), Library::PodType::size, Platform::sizeof_long_double, Platform::sizeof_long_long, Token::str(), and Token::tokType().
Referenced by checkBufferSize(), CheckOther::checkIncompleteArrayFill(), TemplateSimplifier::simplifyTemplateArgs(), and SymbolDatabase::sizeOfType().
|
private |
Split up template right angle brackets.
foo < bar < >> => foo < bar < > >
Definition at line 6340 of file tokenize.cpp.
References debug, Token::findClosingBracket(), TokenList::front(), getExpression(), Token::insertToken(), Token::isStandardType(), list, Token::Match(), Token::next(), Token::previous(), reportError(), Token::simpleMatch(), Token::str(), Token::strAt(), TemplateSimplifier::templateParameters(), and Token::tokAt().
Referenced by simplifyTokenList1().
Helper function to check for start of function execution scope.
Do not use this in checks. Use the symbol database.
tok | pointer to end parentheses of parameter list |
Definition at line 3926 of file tokenize.cpp.
References isFunctionHead(), Token::linkAt(), Token::Match(), Token::next(), and Token::str().
Referenced by TemplateSimplifier::checkComplicatedSyntaxErrorsInTemplates(), and simplifyLabelsCaseDefault().
void Tokenizer::syntaxError | ( | const Token * | tok, |
const std::string & | code = emptyString |
||
) | const |
Syntax error.
Definition at line 8050 of file tokenize.cpp.
References printDebugOutput(), and InternalError::SYNTAX.
Referenced by Function::addArguments(), checkForEnumsWithTypedef(), SymbolDatabase::createSymbolDatabaseEnums(), SymbolDatabase::createSymbolDatabaseFindAllScopes(), duplicateTypedef(), elseif(), SymbolDatabase::isFunction(), markCppCasts(), processFunc(), removeExtraTemplateKeywords(), setVarIdPass1(), setVarIdPass2(), simplifyAddBracesPair(), simplifyAddBracesToCommand(), simplifyFunctionParameters(), simplifyFunctionPointers(), simplifyLabelsCaseDefault(), simplifySQL(), simplifyTokenList1(), simplifyTypedefCpp(), simplifyUsing(), and simplifyVarDecl().
void Tokenizer::syntaxErrorC | ( | const Token * | tok, |
const std::string & | what | ||
) | const |
Syntax error.
C++ code in C file.
Definition at line 8064 of file tokenize.cpp.
References printDebugOutput(), and InternalError::SYNTAX.
Referenced by setVarIdPass1(), and validateC().
|
inline |
Definition at line 596 of file tokenize.h.
References TokenList::front().
|
inline |
Definition at line 592 of file tokenize.h.
References TokenList::front().
Referenced by CheckBufferOverrun::arrayIndex(), CheckCondition::assignIf(), CheckUninitVar::check(), CheckString::checkAlwaysTrueOrFalseStringCompare(), CheckCondition::checkBadBitmaskCheck(), CheckOther::checkCommaSeparatedReturn(), checkConfiguration(), CheckOther::checkConstPointer(), CheckStl::checkDereferenceInvalidIterator2(), CppCheck::checkFile(), CheckType::checkFloatToIntegerOverflow(), CheckOther::checkIncompleteStatement(), CheckType::checkIntegerOverflow(), CheckOther::checkInterlockedDecrement(), CheckCondition::checkInvalidTestForOverflow(), CheckFunctions::checkLibraryMatchFunctions(), CheckType::checkLongCast(), CheckOther::checkModuloOfOne(), CheckOther::checkNanInArithmeticExpression(), CheckOther::checkNegativeBitwiseShift(), CheckOther::checkRedundantPointerOp(), CheckType::checkSignConversion(), CheckUnusedVar::checkStructMemberUsage(), CheckType::checkTooBigBitwiseShift(), CheckOther::checkZeroDivision(), CheckCondition::comparison(), SymbolDatabase::createSymbolDatabaseFindAllScopes(), Scope::getVariableList(), CheckCondition::isAliased(), SuppressionList::markUnmatchedInlineSuppressionsAsChecked(), CheckNullPointer::nullPointerByDeRefAndChec(), CheckUnusedFunctions::parseTokens(), CheckBufferOverrun::pointerArithmetic(), reportUnknownMacros(), setValues(), simplifyTokens1(), CheckSizeof::sizeofCalculation(), CheckSizeof::sizeofFunction(), CheckSizeof::sizeofsizeof(), CheckSizeof::sizeofVoid(), CheckSizeof::suspiciousSizeofCalculation(), SymbolDatabase::SymbolDatabase(), CheckClass::thisSubtraction(), validate(), validateC(), and CheckClass::virtualDestructor().
|
private |
Report that there is an unhandled "class x y {" code.
Definition at line 8076 of file tokenize.cpp.
References information, reportError(), Token::str(), and Token::strAt().
Referenced by simplifyTokenList1().
void Tokenizer::unhandledCharLiteral | ( | const Token * | tok, |
const std::string & | msg | ||
) | const |
Definition at line 8102 of file tokenize.cpp.
References portability, reportError(), and Token::str().
Referenced by simplifyTokens1().
void Tokenizer::unknownMacroError | ( | const Token * | tok1 | ) | const |
Warn about unknown macro(s), configuration is recommended.
Definition at line 8070 of file tokenize.cpp.
References printDebugOutput(), Token::str(), and InternalError::UNKNOWN_MACRO.
Referenced by elseif(), removeMacrosInGlobalScope(), reportUnknownMacros(), and simplifyAddBracesPair().
void Tokenizer::unmatchedToken | ( | const Token * | tok | ) | const |
Syntax error.
Unmatched character.
Definition at line 8056 of file tokenize.cpp.
References mConfiguration, printDebugOutput(), Token::str(), and InternalError::SYNTAX.
Referenced by SymbolDatabase::addNewFunction(), createLinks(), and linkBrackets().
|
private |
Definition at line 338 of file tokenize.cpp.
References debug, Settings::debugwarnings, mSettings, Token::next(), reportError(), and Token::str().
Referenced by simplifyTypedefCpp().
|
private |
assert that tokens are ok - used during debugging for example to catch problems in simplifyTokenList1/2.
Definition at line 8197 of file tokenize.cpp.
References TokenList::back(), cppcheckError(), Token::link(), list, Token::Match(), Token::next(), Token::str(), and tokens().
Referenced by findComplicatedSyntaxErrorsInTemplates(), and simplifyTokenList1().
|
private |
Is there C++ code in C file?
Definition at line 8168 of file tokenize.cpp.
References isCPP(), Token::Match(), Token::next(), Token::previous(), Token::simpleMatch(), Token::str(), Token::strAt(), syntaxErrorC(), Token::tokAt(), and tokens().
Referenced by simplifyTokenList1().
|
inline |
Get variable count.
Definition at line 583 of file tokenize.h.
Referenced by SymbolDatabase::createSymbolDatabaseVariableSymbolTable().
|
friend |
Definition at line 48 of file tokenize.h.
|
friend |
Definition at line 49 of file tokenize.h.
|
friend |
Definition at line 51 of file tokenize.h.
|
friend |
Definition at line 52 of file tokenize.h.
|
friend |
Definition at line 53 of file tokenize.h.
TokenList Tokenizer::list |
Token list: stores all tokens.
Definition at line 590 of file tokenize.h.
Referenced by addSemicolonAfterUnknownMacro(), arraySize(), CheckAssert::assertWithSideEffects(), calculateScopes(), CppCheck::checkClang(), CppCheck::checkFile(), checkForEnumsWithTypedef(), CppCheck::checkNormalTokens(), combineOperators(), combineStringAndCharLiterals(), concatenateNegativeNumberAndAnyPositive(), Summaries::create(), createLinks(), createLinks2(), SymbolDatabase::createSymbolDatabaseEnums(), SymbolDatabase::createSymbolDatabaseExprIds(), SymbolDatabase::createSymbolDatabaseFindAllScopes(), SymbolDatabase::createSymbolDatabaseIncompleteVars(), SymbolDatabase::createSymbolDatabaseSetFunctionPointers(), SymbolDatabase::createSymbolDatabaseSetScopePointers(), SymbolDatabase::createSymbolDatabaseSetTypePointers(), SymbolDatabase::createSymbolDatabaseSetVariablePointers(), SymbolDatabase::debugMessage(), SymbolDatabase::debugSymbolDatabase(), deleteInvalidTypedef(), dump(), elseif(), CTU::getFileInfo(), CheckClass::getFileInfo(), CTU::getFunctionId(), markCppCasts(), SuppressionList::markUnmatchedInlineSuppressionsAsChecked(), clangimport::parseClangAstDump(), CheckUnusedFunctions::parseTokens(), printDebugOutput(), SymbolDatabase::printOut(), SymbolDatabase::printVariable(), removeExtraTemplateKeywords(), removeMacroInClassDef(), removeMacrosInGlobalScope(), removePragma(), removeRedundantSemicolons(), CheckMemoryLeak::reportErr(), Check::reportError(), SymbolDatabase::returnImplicitIntError(), scopeToString(), SymbolDatabase::setValueTypeInTokenList(), setVarId(), setVarIdPass1(), setVarIdPass2(), simplifyAddBraces(), simplifyArrayAccessSyntax(), simplifyCAlternativeTokens(), simplifyCaseRange(), simplifyDoublePlusAndDoubleMinus(), simplifyEmptyNamespaces(), simplifyExternC(), simplifyFunctionParameters(), simplifyFunctionPointers(), simplifyHeadersAndUnusedTemplates(), simplifyIfSwitchForInit(), simplifyInitVar(), simplifyLabelsCaseDefault(), simplifyParameterVoid(), simplifyPointerToStandardType(), simplifyRedundantConsecutiveBraces(), simplifyRedundantParentheses(), simplifyRoundCurlyParentheses(), simplifySQL(), simplifyStaticConst(), TemplateSimplifier::simplifyTemplateInstantiations(), TemplateSimplifier::simplifyTemplates(), simplifyTokenList1(), simplifyTokens1(), simplifyTypedef(), simplifyTypedefCpp(), simplifyTypedefLHS(), simplifyTypeIntrinsics(), simplifyUsing(), simplifyUsingError(), simplifyUsingToTypedef(), simplifyVarDecl(), simplifyVariableMultipleAssign(), sizeofAddParentheses(), splitTemplateRightAngleBrackets(), tokenToString(), TemplateSimplifier::useDefaultArgumentValues(), validate(), SymbolDatabase::validateExecutableScopes(), and SymbolDatabase::~SymbolDatabase().
|
private |
E.g.
"A" for code where "#ifdef A" is true. This is used to print additional information in error situations.
Definition at line 657 of file tokenize.h.
Referenced by simplifyTokens1(), and unmatchedToken().
|
private |
Definition at line 671 of file tokenize.h.
Referenced by dump().
|
private |
errorlogger
Definition at line 648 of file tokenize.h.
Referenced by simplifyTokens1(), simplifyTypedefCpp(), simplifyUsing(), and simplifyUsingError().
|
private |
settings
Definition at line 645 of file tokenize.h.
Referenced by checkConfiguration(), combineStringAndCharLiterals(), dump(), fillTypeSizes(), isScopeNoReturn(), printDebugOutput(), removePragma(), setVarIdPass1(), simplifyHeadersAndUnusedTemplates(), simplifyIfSwitchForInit(), simplifyTemplates(), simplifyTokenList1(), simplifyTokens1(), simplifyTypedef(), simplifyTypedefCpp(), simplifyUsing(), simplifyUsingError(), simplifyUsingToTypedef(), simplifyVarDecl(), sizeOfType(), and unsupportedTypedef().
|
private |
Symbol database that all checks etc can use.
Definition at line 651 of file tokenize.h.
Referenced by arraySizeAfterValueFlow(), dump(), printDebugOutput(), simplifyTokens1(), and ~Tokenizer().
|
private |
Definition at line 653 of file tokenize.h.
Referenced by dump(), findComplicatedSyntaxErrorsInTemplates(), simplifyTemplates(), and ~Tokenizer().
|
private |
Definition at line 682 of file tokenize.h.
Referenced by simplifyTokenList1(), and simplifyTokens1().
|
private |
Definition at line 669 of file tokenize.h.
Referenced by dump(), simplifyTypedef(), and simplifyTypedefCpp().
|
private |
sizeof information for known types
Definition at line 660 of file tokenize.h.
Referenced by fillTypeSizes(), and sizeOfType().
|
private |
unnamed count "Unnamed0", "Unnamed1", "Unnamed2", ...
Definition at line 677 of file tokenize.h.
Referenced by simplifyTypedefCpp(), and simplifyUsing().
|
private |
variable count
Definition at line 674 of file tokenize.h.
Referenced by setVarIdPass1(), and setVarIdPass2().