Cppcheck
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
Token Class Reference

The token list that the TokenList generates is a linked-list of this class. More...

#include <token.h>

List of all members.

Public Types

enum  Type {
  eVariable, eType, eFunction, eName,
  eNumber, eString, eChar, eBoolean,
  eLiteral, eArithmeticalOp, eComparisonOp, eAssignmentOp,
  eLogicalOp, eBitOp, eIncDecOp, eExtendedOp,
  eBracket, eOther, eNone
}

Public Member Functions

 Token (Token **tokensBack)
 ~Token ()
void str (const std::string &s)
void concatStr (std::string const &b)
 Concatenate two (quoted) strings.
const std::string & str () const
void deleteNext (unsigned long index=1)
 Unlink and delete the next 'index' tokens.
const TokentokAt (int index) const
 Returns token in given index, related to this token.
TokentokAt (int index)
const TokenlinkAt (int index) const
 Returns the link to the token in given index, related to this token.
TokenlinkAt (int index)
const std::string & strAt (int index) const
Type type () const
void type (Type t)
bool isName () const
bool isUpperCaseName () const
bool isNumber () const
bool isOp () const
bool isConstOp () const
bool isExtendedOp () const
bool isArithmeticalOp () const
bool isComparisonOp () const
bool isAssignmentOp () const
bool isBoolean () const
bool isUnsigned () const
void isUnsigned (bool sign)
bool isSigned () const
void isSigned (bool sign)
bool isPointerCompare () const
void isPointerCompare (bool b)
bool isLong () const
void isLong (bool size)
bool isUnused () const
void isUnused (bool used)
bool isStandardType () const
bool isExpandedMacro () const
void setExpandedMacro (bool m)
unsigned int linenr () const
void linenr (unsigned int lineNumber)
unsigned int fileIndex () const
void fileIndex (unsigned int indexOfFile)
Tokennext () const
void insertToken (const std::string &tokenStr, bool prepend=false)
 Insert new token after this token.
Tokenprevious () const
unsigned int varId () const
void varId (unsigned int id)
void printOut (const char *title=0) const
 For debugging purposes, prints token and all tokens followed by it.
void printOut (const char *title, const std::vector< std::string > &fileNames) const
 For debugging purposes, prints token and all tokens followed by it.
void stringify (std::ostream &os, bool varid, bool attributes) const
 Stringify a token.
std::string stringifyList (bool varid, bool attributes, bool linenumbers, bool linebreaks, bool files, const std::vector< std::string > *fileNames=0, const Token *end=0) const
 Stringify a list of token, from current instance on.
std::string stringifyList (const Token *end, bool attributes=true) const
std::string stringifyList (bool varid=false) const
void deleteThis ()
 Remove the contents for this token from the token list.
void link (Token *linkToToken)
 Create link to given token.
Tokenlink () const
 Return token where this token links to.
void scope (const Scope *s)
 Associate this token with given scope.
const Scopescope () const
 Returns a pointer to the scope containing this token.
void function (const Function *f)
 Associate this token with given function.
const Functionfunction () const
 Returns a pointer to the Function associated with this token.
void variable (const Variable *v)
 Associate this token with given variable.
const Variablevariable () const
 Returns a pointer to the variable associated with this token.
std::string strValue () const
 This can be called only for tokens that are strings, else the assert() is called.
unsigned int progressValue () const
 Get progressValue.
void assignProgressValues ()
 Calculate progress values for all tokens.
TokennextArgument () const
 Returns the first token of the next argument.
bool findClosingBracket (const Token *&closing) const
 Returns the closing bracket of opening '<'.
bool findClosingBracket (Token *&closing) const
void astOperand1 (Token *tok)
void astOperand2 (Token *tok)
void astFunctionCall ()
void astHandleParentheses ()
const TokenastOperand1 () const
const TokenastOperand2 () const
const TokenastTop () const
std::string astString () const

Static Public Member Functions

static bool simpleMatch (const Token *tok, const char pattern[])
 Match given token (or list of tokens) to a pattern list.
static bool Match (const Token *tok, const char pattern[], unsigned int varid=0)
 Match given token (or list of tokens) to a pattern list.
static std::size_t getStrLength (const Token *tok)
 Return length of C-string.
static std::string getCharAt (const Token *tok, std::size_t index)
 Return char of C-string at index (possible escaped "\\n")
static const Tokenfindsimplematch (const Token *tok, const char pattern[])
static const Tokenfindsimplematch (const Token *tok, const char pattern[], const Token *end)
static const Tokenfindmatch (const Token *tok, const char pattern[], unsigned int varId=0)
static const Tokenfindmatch (const Token *tok, const char pattern[], const Token *end, unsigned int varId=0)
static Tokenfindsimplematch (Token *tok, const char pattern[])
static Tokenfindsimplematch (Token *tok, const char pattern[], const Token *end)
static Tokenfindmatch (Token *tok, const char pattern[], unsigned int varId=0)
static Tokenfindmatch (Token *tok, const char pattern[], const Token *end, unsigned int varId=0)
static int multiCompare (const Token *tok, const char *haystack, const char *needle)
 Needle is build from multiple alternatives.
static void eraseTokens (Token *begin, const Token *end)
 Delete tokens between begin and end.
static void replace (Token *replaceThis, Token *start, Token *end)
 Replace token replaceThis with tokens between start and end, including start and end.
static void createMutualLinks (Token *begin, Token *end)
 Links two elements against each other.
static void move (Token *srcStart, Token *srcEnd, Token *newLocation)
 Move srcStart and srcEnd tokens and all tokens between them into new a location.

Private Member Functions

 Token ()
 Token (const Token &)
Token operator= (const Token &)
void next (Token *nextToken)
void previous (Token *previousToken)
void update_property_info ()
 Updates internal property cache like _isName or _isBoolean.
void update_property_isStandardType ()
 Update internal property cache about isStandardType()

Static Private Member Functions

static bool firstWordEquals (const char *str, const char *word)
 Works almost like strcmp() except returns only true or false and if str has empty space ' ' character, that character is handled as if it were '\0'.
static const char * chrInFirstWord (const char *str, char c)
 Works almost like strchr() except if str has empty space ' ' character, that character is handled as if it were '\0'.
static int firstWordLen (const char *str)
 Works almost like strlen() except if str has empty space ' ' character, that character is handled as if it were '\0'.

Private Attributes

Token ** tokensBack
Token_next
Token_previous
Token_link
const Scope_scope
union {
   const Function *   _function
   const Variable *   _variable
}; 
std::string _str
unsigned int _varId
unsigned int _fileIndex
unsigned int _linenr
unsigned int _progressValue
 A value from 0-100 that provides a rough idea about where in the token list this token is located.
Type _type
bool _isUnsigned
bool _isSigned
bool _isPointerCompare
bool _isLong
bool _isUnused
bool _isStandardType
bool _isExpandedMacro
Token_astOperand1
Token_astOperand2
Token_astParent

Detailed Description

The token list that the TokenList generates is a linked-list of this class.

Tokens are stored as strings. The "if", "while", etc are stored in plain text. The reason the Token class is needed (instead of using the string class) is that some extra functionality is also needed for tokens:

The Token class also has other functions for management of token list, matching tokens, etc.

Definition at line 44 of file token.h.


Member Enumeration Documentation

Enumerator:
eVariable 
eType 
eFunction 
eName 
eNumber 
eString 
eChar 
eBoolean 
eLiteral 
eArithmeticalOp 
eComparisonOp 
eAssignmentOp 
eLogicalOp 
eBitOp 
eIncDecOp 
eExtendedOp 
eBracket 
eOther 
eNone 

Definition at line 54 of file token.h.


Constructor & Destructor Documentation

Token::Token ( ) [private]

Referenced by insertToken().

Token::Token ( const Token ) [private]
Token::Token ( Token **  tokensBack) [explicit]

Definition at line 31 of file token.cpp.

Definition at line 57 of file token.cpp.


Member Function Documentation

void Token::assignProgressValues ( ) [inline]

Calculate progress values for all tokens.

Definition at line 527 of file token.h.

References next().

Referenced by TokenList::createTokens(), Tokenizer::simplifyTokenList(), and Tokenizer::tokenize().

Definition at line 1079 of file token.cpp.

References _astOperand1, _astParent, and _next.

Definition at line 1085 of file token.cpp.

References _astOperand1, _astOperand2, _astParent, _next, _previous, _str, and Match().

void Token::astOperand1 ( Token tok)

Definition at line 1061 of file token.cpp.

References _astOperand1, and _astParent.

Referenced by TokenList::createAst().

const Token* Token::astOperand1 ( ) const [inline]

Definition at line 634 of file token.h.

void Token::astOperand2 ( Token tok)

Definition at line 1070 of file token.cpp.

References _astOperand2, and _astParent.

const Token* Token::astOperand2 ( ) const [inline]

Definition at line 637 of file token.h.

std::string Token::astString ( ) const [inline]

Definition at line 647 of file token.h.

const Token* Token::astTop ( ) const [inline]

Definition at line 640 of file token.h.

References _astParent.

const char * Token::chrInFirstWord ( const char *  str,
char  c 
) [static, private]

Works almost like strchr() except if str has empty space ' ' character, that character is handled as if it were '\0'.

Definition at line 486 of file token.cpp.

References str().

Referenced by Match().

void Token::concatStr ( std::string const &  b)

Concatenate two (quoted) strings.

Automatically cuts of the last/first character. Example: "hello ""world" -> "hello world". Used by the token simplifier.

Definition at line 158 of file token.cpp.

References _str, and update_property_info().

void Token::createMutualLinks ( Token begin,
Token end 
) [static]
void Token::deleteNext ( unsigned long  index = 1)
void Token::eraseTokens ( Token begin,
const Token end 
) [static]
unsigned int Token::fileIndex ( ) const [inline]
void Token::fileIndex ( unsigned int  indexOfFile) [inline]

Definition at line 319 of file token.h.

bool Token::findClosingBracket ( const Token *&  closing) const

Returns the closing bracket of opening '<'.

Should only be used if link() is unavailable.

Parameters:
closingThe closing token is stored in that parameter
Returns:
success

Definition at line 832 of file token.cpp.

References _str, link(), next(), and str().

Referenced by Variable::evaluate(), TemplateSimplifier::getTemplateInstantiations(), Type::initBaseInfo(), Scope::isVariableDeclaration(), setVarIdParseDeclaration(), Tokenizer::simplifyCasts(), Tokenizer::simplifyComma(), Tokenizer::simplifyTypedef(), and Tokenizer::simplifyVarDecl().

bool Token::findClosingBracket ( Token *&  closing) const [inline]

Definition at line 549 of file token.h.

const Token * Token::findmatch ( const Token tok,
const char  pattern[],
unsigned int  varId = 0 
) [static]
const Token * Token::findmatch ( const Token tok,
const char  pattern[],
const Token end,
unsigned int  varId = 0 
) [static]

Definition at line 887 of file token.cpp.

References Match(), and next().

static Token* Token::findmatch ( Token tok,
const char  pattern[],
unsigned int  varId = 0 
) [inline, static]

Definition at line 286 of file token.h.

static Token* Token::findmatch ( Token tok,
const char  pattern[],
const Token end,
unsigned int  varId = 0 
) [inline, static]

Definition at line 289 of file token.h.

const Token * Token::findsimplematch ( const Token tok,
const char  pattern[] 
) [static]
const Token * Token::findsimplematch ( const Token tok,
const char  pattern[],
const Token end 
) [static]

Definition at line 869 of file token.cpp.

References next(), and simpleMatch().

static Token* Token::findsimplematch ( Token tok,
const char  pattern[] 
) [inline, static]

Definition at line 280 of file token.h.

static Token* Token::findsimplematch ( Token tok,
const char  pattern[],
const Token end 
) [inline, static]

Definition at line 283 of file token.h.

bool Token::firstWordEquals ( const char *  str,
const char *  word 
) [static, private]

Works almost like strcmp() except returns only true or false and if str has empty space ' ' character, that character is handled as if it were '\0'.

Definition at line 471 of file token.cpp.

References str().

Referenced by Match().

int Token::firstWordLen ( const char *  str) [static, private]

Works almost like strlen() except if str has empty space ' ' character, that character is handled as if it were '\0'.

Definition at line 499 of file token.cpp.

References str().

Referenced by Match().

void Token::function ( const Function f) [inline]
const Function* Token::function ( ) const [inline]

Returns a pointer to the Function associated with this token.

Definition at line 476 of file token.h.

std::string Token::getCharAt ( const Token tok,
std::size_t  index 
) [static]

Return char of C-string at index (possible escaped "\\n")

Should be called for str% tokens only.

Parameters:
toktoken with C-string
indexposition of character

Definition at line 768 of file token.cpp.

References str(), and strValue().

Referenced by Tokenizer::simplifyCharAt().

std::size_t Token::getStrLength ( const Token tok) [static]
void Token::insertToken ( const std::string &  tokenStr,
bool  prepend = false 
)
bool Token::isArithmeticalOp ( ) const [inline]
bool Token::isAssignmentOp ( ) const [inline]
bool Token::isBoolean ( ) const [inline]
bool Token::isComparisonOp ( ) const [inline]

Definition at line 226 of file token.h.

Referenced by if_findCompare(), and Match().

bool Token::isConstOp ( ) const [inline]
bool Token::isExpandedMacro ( ) const [inline]
bool Token::isExtendedOp ( ) const [inline]

Definition at line 219 of file token.h.

Referenced by Tokenizer::simplifyKnownVariablesSimplify().

bool Token::isLong ( ) const [inline]
void Token::isLong ( bool  size) [inline]

Definition at line 257 of file token.h.

bool Token::isName ( ) const [inline]
bool Token::isNumber ( ) const [inline]
bool Token::isOp ( ) const [inline]
bool Token::isPointerCompare ( ) const [inline]
void Token::isPointerCompare ( bool  b) [inline]

Definition at line 251 of file token.h.

bool Token::isSigned ( ) const [inline]
void Token::isSigned ( bool  sign) [inline]

Definition at line 245 of file token.h.

bool Token::isStandardType ( ) const [inline]
bool Token::isUnsigned ( ) const [inline]
void Token::isUnsigned ( bool  sign) [inline]

Definition at line 239 of file token.h.

bool Token::isUnused ( ) const [inline]
void Token::isUnused ( bool  used) [inline]

Definition at line 263 of file token.h.

bool Token::isUpperCaseName ( ) const

Definition at line 139 of file token.cpp.

References _str, and isName().

Referenced by CheckClass::checkConst(), UninitVar::parse(), and Tokenizer::removeMacroInVarDecl().

unsigned int Token::linenr ( ) const [inline]
void Token::linenr ( unsigned int  lineNumber) [inline]

Definition at line 312 of file token.h.

void Token::link ( Token linkToToken) [inline]

Create link to given token.

Parameters:
linkToTokenThe token where this token should link to.

Definition at line 427 of file token.h.

Referenced by Function::addArguments(), SymbolDatabase::addNewFunction(), UninitVar::analyseFunctions(), Variable::arrayDimensions(), Tokenizer::arraySize(), CheckAssignIf::assignIfParseScope(), CheckMemoryLeakNoVar::check(), CheckOther::checkAssignmentInAssert(), CheckBoost::checkBoostForeachModification(), CheckOther::checkComparisonOfBoolExpressionWithInt(), CheckOther::checkComparisonOfFuncReturningBool(), CheckClass::checkConstFunc(), CheckOther::checkDuplicateExpression(), CheckOther::checkDuplicateIf(), CheckUnusedVar::checkFunctionVariableUsage_iterateScopes(), CheckBufferOverrun::checkGlobalAndLocalVariable(), CheckUninitVar::checkIfForWhileHead(), CheckOther::checkInnerScope(), CheckBufferOverrun::checkInsecureCmdLineArgs(), CheckUninitVar::checkLoopBody(), CheckOther::checkMemsetZeroBytes(), CheckBufferOverrun::checkReadlinkBufferUsage(), CheckOther::checkRedundantAssignment(), CheckOther::checkRedundantAssignmentInSwitch(), CheckLeakAutoVar::checkScope(), ExecutionPath::checkScope(), CheckBufferOverrun::checkScope(), EraseCheckLoop::checkScope(), CheckBufferOverrun::checkScopeForBody(), CheckUninitVar::checkScopeForVariable(), CheckOther::checkUnreachableCode(), CheckOther::checkUnsignedDivision(), CheckOther::checkVarFuncNullUB(), Scope::checkVariable(), CheckOther::checkVariableScope(), CheckOther::clarifyCalculation(), CheckOther::clarifyCondition(), CheckOther::clarifyStatement(), CheckAssignIf::comparison(), CheckOther::complexDuplicateExpressionCheck(), CheckClass::constructors(), Tokenizer::copyTokens(), countMinArgs(), createMutualLinks(), deleteThis(), doAssignment(), Tokenizer::duplicateDefinition(), Tokenizer::duplicateTypedef(), Tokenizer::eraseDeadCode(), Variable::evaluate(), findClosingBracket(), for_bailout(), for_condition(), CheckMemoryLeak::getAllocationType(), CheckMemoryLeakInFunction::getcode(), CheckMemoryLeak::getReallocationType(), Scope::getVariableList(), CheckClass::hasAssignSelf(), TemplateSimplifier::hasComplicatedSyntaxErrorsInTemplates(), CheckStl::if_find(), if_findCompare(), CheckClass::initializerListOrder(), CheckClass::initializeVarList(), Tokenizer::initVar(), CheckOther::invalidPointerCast(), SymbolDatabase::isFunction(), CheckClass::isMemberVar(), isPartOfClassStructUnion(), CheckNullPointer::isPointerDeRef(), Scope::isVariableDeclaration(), CheckUninitVar::isVariableUsage(), linkAt(), CheckAssignIf::multiCondition(), CheckBufferOverrun::negativeIndex(), nextArgument(), CheckNullPointer::nullConstantDereference(), CheckNullPointer::nullPointerByCheckAndDeRef(), CheckNullPointer::nullPointerByDeRefAndChec(), CheckNullPointer::nullPointerDefaultArgument(), CheckNullPointer::nullPointerStructByDeRefAndChec(), UninitVar::parse(), Nullpointer::parse(), CheckBufferOverrun::parse_for_body(), UninitVar::parserhs(), CheckUnusedFunctions::parseTokens(), processFunc(), Tokenizer::removeRedundantAssignment(), Tokenizer::removeRedundantConditions(), Tokenizer::removeRedundantFor(), Tokenizer::removeUnnecessaryQualification(), CheckAutoVariables::returnTemporary(), Tokenizer::setVarId(), setVarIdClassDeclaration(), setVarIdParseDeclaration(), Tokenizer::simplifyAddBracesPair(), Tokenizer::simplifyAddBracesToCommand(), Tokenizer::simplifyAsm(), Tokenizer::simplifyAssignmentInFunctionCall(), Tokenizer::simplifyBitfields(), Tokenizer::simplifyBorland(), Tokenizer::simplifyBuiltinExpect(), Tokenizer::simplifyCasts(), Tokenizer::simplifyComma(), Tokenizer::simplifyCompoundAssignment(), Tokenizer::simplifyConditions(), Tokenizer::simplifyEnum(), Tokenizer::simplifyErrNoInWhile(), Tokenizer::simplifyFlowControl(), Tokenizer::simplifyFuncInWhile(), Tokenizer::simplifyFunctionParameters(), Tokenizer::simplifyFunctionPointers(), Tokenizer::simplifyGoto(), Tokenizer::simplifyIfAssign(), Tokenizer::simplifyIfNot(), Tokenizer::simplifyKnownVariablesGetData(), Tokenizer::simplifyKnownVariablesSimplify(), Tokenizer::simplifyLogicalOperators(), Tokenizer::simplifyMathExpressions(), Tokenizer::simplifyMicrosoftMemoryFunctions(), Tokenizer::simplifyNestedStrcat(), Tokenizer::simplifyOperatorName(), Tokenizer::simplifyRealloc(), Tokenizer::simplifyRedundantParentheses(), Tokenizer::simplifyReference(), Tokenizer::simplifyReturnStrncat(), Tokenizer::simplifyStructDecl(), Tokenizer::simplifyStructInit(), Tokenizer::simplifyTokenList(), Tokenizer::simplifyTypedef(), Tokenizer::simplifyVarDecl(), Tokenizer::simplifyWhile0(), skipBrackets(), skipBracketsAndMembers(), splitDefinitionFromTypedef(), CheckStl::string_c_str(), SymbolDatabase::SymbolDatabase(), TemplateSimplifier::templateParameters(), TemplateSimplifier::useDefaultArgumentValues(), and CheckMemoryLeakInClass::variable().

Token* Token::link ( ) const [inline]

Return token where this token links to.

Supported links are: "{" <-> "}" "(" <-> ")" "[" <-> "]"

Returns:
The token where this token links to.

Definition at line 442 of file token.h.

const Token * Token::linkAt ( int  index) const

Returns the link to the token in given index, related to this token.

For example index 1 would return the link to next token.

Definition at line 288 of file token.cpp.

References link(), and tokAt().

Referenced by Tokenizer::arraySize(), CheckAutoVariables::autoVariables(), bailoutIfSwitch(), CheckMemoryLeakInFunction::call_func(), CheckOther::checkConstantFunctionParameter(), CheckClass::checkConstFunc(), CheckOther::checkDoubleFree(), CheckOther::checkDuplicateBranch(), CheckOther::checkDuplicateIf(), CheckIO::checkFileUsage(), checkFunctionUsage(), CheckUnusedVar::checkFunctionVariableUsage_iterateScopes(), CheckOther::checkIncompleteArrayFill(), CheckOther::checkInnerScope(), CheckOther::checkInvalidFree(), CheckMemoryLeakInFunction::checkReallocUsage(), CheckOther::checkRedundantCopy(), CheckClass::checkReturnPtrThis(), CheckLeakAutoVar::checkScope(), ExecutionPath::checkScope(), CheckBufferOverrun::checkScope(), CheckUninitVar::checkScopeForVariable(), CheckOther::checkSelfAssignment(), CheckMemoryLeakStructMember::checkStructVariable(), CheckOther::checkSuspiciousEqualityComparison(), Scope::checkVariable(), CheckClass::copyconstructors(), Tokenizer::deleteInvalidTypedef(), Tokenizer::duplicateTypedef(), Tokenizer::eraseDeadCode(), CheckMemoryLeakInFunction::getcode(), CheckStl::if_find(), CheckClass::initializationListUsage(), CheckClass::initializeVarList(), isComplexType(), isInitList(), CheckClass::isMemberVar(), Tokenizer::IsScopeNoReturn(), CheckStl::iterators(), CheckStl::mismatchingContainers(), CheckStl::missingComparison(), CheckAssignIf::multiCondition(), CheckNullPointer::nullPointerByCheckAndDeRef(), CheckNullPointer::nullPointerLinkedList(), CheckOther::oppositeInnerCondition(), UninitVar::parse(), Nullpointer::parse(), UninitVar::parseLoopBody(), CheckUnusedFunctions::parseTokens(), processFunc(), CheckStl::pushback(), Tokenizer::removeRedundantConditions(), Tokenizer::removeRedundantFor(), CheckAutoVariables::returnTemporary(), Tokenizer::setVarId(), Tokenizer::simplifyBuiltinExpect(), Tokenizer::simplifyFlowControl(), Tokenizer::simplifyFunctionPointers(), Tokenizer::simplifyKnownVariablesGetData(), Tokenizer::simplifyKnownVariablesSimplify(), Tokenizer::simplifyMathExpressions(), Tokenizer::simplifyReturnStrncat(), Tokenizer::simplifyTypedef(), CheckOther::sizeofCalculation(), splitDefinitionFromTypedef(), CheckOther::suspiciousSizeofCalculation(), SymbolDatabase::SymbolDatabase(), and CheckClass::virtualDestructor().

Token* Token::linkAt ( int  index) [inline]

Definition at line 98 of file token.h.

bool Token::Match ( const Token tok,
const char  pattern[],
unsigned int  varid = 0 
) [static]

Match given token (or list of tokens) to a pattern list.

Possible patterns

  • "%any%" any token
  • "%var%" any token which is a name or type e.g. "hello" or "int"
  • "%type%" Anything that can be a variable type, e.g. "int", but not "delete".
  • "%num%" Any numeric token, e.g. "23"
  • "%bool%" true or false
  • "%char%" Any token enclosed in '-character.
  • "%comp%" Any token such that isComparisonOp() returns true.
  • "%str%" Any token starting with "-character (C-string).
  • "%varid%" Match with parameter varid
  • "%op%" Any token such that isOp() returns true.
  • "%cop%" Any token such that isConstOp() returns true.
  • "%or%" A bitwise-or operator '|'
  • "%oror%" A logical-or operator '||'
  • "[abc]" Any of the characters 'a' or 'b' or 'c'
  • "int|void|char" Any of the strings, int, void or char
  • "int|void|char|" Any of the strings, int, void or char or empty string
  • "!!else" No tokens or any token that is not "else".
  • "someRandomText" If token contains "someRandomText".

multi-compare patterns such as "int|void|char" can contain or%, oror% and op% but it is not recommended to put such an cmd% as the first pattern.

It's possible to use multi-compare patterns with all the other cmds%, except for varid%, and normal names, but the cmds% should be put as the first patterns in the list, then the normal names. For example: "%var%|%num%|)" means yes to a variable, a number or ')'.

Todo:
Make it possible to use the cmds% and the normal names in the multicompare list without an order.

The patterns can be also combined to compare to multiple tokens at once by separating tokens with a space, e.g. ") const|void {" will return true if first token is ')' next token is either "const" or "void" and token after that is '{'. If even one of the tokens does not match its pattern, false is returned.

Parameters:
tokList of tokens to be compared to the pattern
patternThe pattern against which the tokens are compared, e.g. "const" or ") const|volatile| {".
varidif varid% is given in the pattern the Token::varId will be matched against this argument
Returns:
true if given token matches with given pattern false if given token does not match with given pattern

Definition at line 529 of file token.cpp.

References _str, chrInFirstWord(), eChar, eString, firstWordEquals(), firstWordLen(), isBoolean(), isComparisonOp(), isConstOp(), isName(), isNumber(), isOp(), multiCompare(), multicompare, next(), str(), type(), and varId().

Referenced by Function::addArguments(), SymbolDatabase::addNewFunction(), UninitVar::analyseFunctions(), analyzeLogicOperatorCondition(), analyzeType(), Function::argsMatch(), CheckBufferOverrun::arrayIndexInForLoop(), CheckBufferOverrun::arrayIndexThenCheck(), Tokenizer::arraySize(), CheckAssignIf::assignIf(), CheckAssignIf::assignIfParseScope(), astHandleParentheses(), CheckAutoVariables::autoVariables(), CheckMemoryLeakInFunction::call_func(), CheckNullPointer::CanFunctionAssignPointer(), CheckMemoryLeakNoVar::check(), CheckOther::checkAssignBoolToPointer(), CheckOther::checkAssignmentInAssert(), CheckStl::checkAutoPointer(), CheckOther::checkBitwiseOnBoolean(), CheckBoost::checkBoostForeachModification(), CheckBufferOverrun::checkBufferAllocatedWithStrlen(), CheckOther::checkCastIntToCharAndBack(), CheckOther::checkCCTypeFunctions(), CheckOther::checkCharVariable(), CheckOther::checkComparisonOfBoolExpressionWithInt(), CheckOther::checkComparisonOfFuncReturningBool(), CheckClass::checkConst(), CheckOther::checkConstantFunctionParameter(), CheckClass::checkConstFunc(), CheckIO::checkCoutCerrMisusage(), CheckOther::checkDoubleFree(), CheckOther::checkDuplicateExpression(), CheckOther::checkExpressionRange(), CheckIO::checkFileUsage(), CheckBufferOverrun::checkFunctionCall(), CheckBufferOverrun::checkFunctionParameter(), CheckUnusedVar::checkFunctionVariableUsage_iterateScopes(), CheckBufferOverrun::checkGlobalAndLocalVariable(), CheckUninitVar::checkIfForWhileHead(), CheckOther::checkIncompleteArrayFill(), CheckOther::checkIncompleteStatement(), CheckOther::checkIncorrectLogicOperator(), CheckOther::checkIncorrectStringCompare(), CheckOther::checkIncrementBoolean(), CheckOther::checkInnerScope(), CheckBufferOverrun::checkInsecureCmdLineArgs(), CheckOther::checkInvalidFree(), CheckUninitVar::checkLoopBody(), CheckOther::checkMathFunctions(), CheckOther::checkMisusedScopedObject(), CheckOther::checkModuloAlwaysTrueFalse(), CheckOther::checkNegativeBitwiseShift(), CheckOther::checkPipeParameterSize(), CheckMemoryLeakInClass::checkPublicFunctions(), CheckBufferOverrun::checkReadlinkBufferUsage(), CheckMemoryLeakInFunction::checkReallocUsage(), CheckOther::checkRedundantAssignment(), CheckOther::checkRedundantAssignmentInSwitch(), CheckOther::checkRedundantCopy(), CheckInternal::checkRedundantNextPrevious(), CheckExceptionSafety::checkRethrowCopy(), CheckClass::checkReturnPtrThis(), CheckUninitVar::checkScope(), CheckLeakAutoVar::checkScope(), ExecutionPath::checkScope(), CheckBufferOverrun::checkScope(), CheckMemoryLeakInFunction::checkScope(), EraseCheckLoop::checkScope(), CheckBufferOverrun::checkScopeForBody(), CheckUninitVar::checkScopeForVariable(), CheckOther::checkSelfAssignment(), CheckOther::checkSignOfUnsignedVariable(), CheckOther::checkSizeofForArrayParameter(), CheckOther::checkSizeofForNumericParameter(), CheckOther::checkSizeofForPointerSize(), CheckOther::checkSleepTimeInterval(), CheckBufferOverrun::checkSprintfCall(), CheckUnusedVar::checkStructMemberUsage(), CheckBufferOverrun::checkStructVariable(), CheckMemoryLeakStructMember::checkStructVariable(), CheckOther::checkSuspiciousCaseInSwitch(), CheckOther::checkSuspiciousEqualityComparison(), CheckOther::checkSuspiciousStringCompare(), CheckOther::checkSwitchCaseFallThrough(), CheckOther::checkUnreachableCode(), CheckOther::checkUnsignedDivision(), CheckOther::checkVarFuncNullUB(), Scope::checkVariable(), CheckOther::checkVariableScope(), CheckIO::checkWrongPrintfScanfArguments(), CheckOther::checkZeroDivision(), CheckOther::clarifyCalculation(), CheckOther::clarifyCondition(), CheckOther::clarifyStatement(), TemplateSimplifier::cleanupAfterSimplify(), PreprocessorMacro::code(), CheckAssignIf::comparison(), CheckOther::complexDuplicateExpressionCheck(), Tokenizer::concatenateDoubleSharp(), Tokenizer::concatenateNegativeNumberAndAnyPositive(), conditionAlwaysTrueOrFalse(), CheckClass::copyconstructors(), countMinArgs(), TokenList::createAst(), Tokenizer::createLinks2(), Tokenizer::createSymbolDatabase(), CheckExceptionSafety::deallocThrow(), Nullpointer::dereference(), doAssignment(), Tokenizer::duplicateDefinition(), Tokenizer::duplicateTypedef(), Tokenizer::elseif(), CheckStl::erase(), Tokenizer::eraseDeadCode(), Variable::evaluate(), PreprocessorMacro::expandInnerMacros(), TemplateSimplifier::expandTemplate(), expressionHasSideEffects(), SymbolDatabase::findFunction(), CheckMemoryLeakInFunction::findleak(), findmatch(), for3(), for_bailout(), for_condition(), for_init(), CheckMemoryLeak::functionArgAlloc(), CheckLeakAutoVar::functionCall(), CheckMemoryLeak::functionReturnType(), CheckMemoryLeak::getAllocationType(), Preprocessor::getcfgs(), Preprocessor::getcode(), CheckMemoryLeakInFunction::getcode(), CheckMemoryLeak::getDeallocationType(), CheckMemoryLeak::getReallocationType(), TemplateSimplifier::getTemplateDeclarations(), TemplateSimplifier::getTemplateInstantiations(), TemplateSimplifier::getTemplateNamePosition(), Scope::getVariableList(), CheckClass::hasAllocation(), CheckClass::hasAssignSelf(), TemplateSimplifier::hasComplicatedSyntaxErrorsInTemplates(), Tokenizer::hasEnumsWithTypedef(), CheckStl::if_find(), if_findCompare(), Type::initBaseInfo(), CheckClass::initializationListUsage(), CheckClass::initializerListOrder(), CheckClass::initializeVarList(), Tokenizer::initVar(), TokenList::insertTokens(), TemplateSimplifier::instantiateMatch(), CheckOther::invalidFunctionUsage(), CheckOther::invalidPointerCast(), CheckIO::invalidScanf(), CheckBufferOverrun::isArrayOfStruct(), isContainerSizeSlow(), SymbolDatabase::isFunction(), isFunctionOrBreakPattern(), Tokenizer::isFunctionParameterPassedByValue(), isInitList(), isint(), isLowerEqualThanMulDiv(), isLowerThanOr(), isLowerThanShift(), CheckMemoryLeakStructMember::isMalloc(), CheckClass::isMemberVar(), CheckUninitVar::isMemberVariableAssignment(), CheckUninitVar::isMemberVariableUsage(), CheckNullPointer::isPointerDeRef(), Tokenizer::IsScopeNoReturn(), CheckOther::isSigned(), Scope::isVariableDeclaration(), CheckUninitVar::isVariableUsage(), CheckStl::iterators(), CheckStl::mismatchingContainers(), CheckStl::missingComparison(), CheckAssignIf::multiCondition(), CheckClass::noMemset(), CheckNonReentrantFunctions::nonReentrantFunctions(), CheckMemoryLeakInFunction::notvar(), CheckNullPointer::nullConstantDereference(), CheckNullPointer::nullPointerByCheckAndDeRef(), CheckNullPointer::nullPointerByDeRefAndChec(), CheckNullPointer::nullPointerDefaultArgument(), CheckNullPointer::nullPointerLinkedList(), CheckNullPointer::nullPointerStructByDeRefAndChec(), CheckObsoleteFunctions::obsoleteFunctions(), CheckClass::operatorEq(), CheckClass::operatorEqRetRefThis(), CheckClass::operatorEqToSelf(), CheckOther::oppositeInnerCondition(), UninitVar::parse(), EraseCheckLoop::parse(), Nullpointer::parse(), ExecutionPathBufferOverrun::parse(), CheckBufferOverrun::parse_for_body(), CheckMemoryLeakInFunction::parse_noreturn(), ExecutionPath::parseCondition(), UninitVar::parseCondition(), Nullpointer::parseCondition(), CheckNullPointer::parseFunctionCall(), Nullpointer::parseLoopBody(), UninitVar::parserhs(), CheckUnusedFunctions::parseTokens(), Check64BitPortability::pointerassignment(), CheckPostfixOperator::postfixOperator(), PreprocessorMacro::PreprocessorMacro(), Tokenizer::printUnknownTypes(), processFunc(), CheckStl::pushback(), Tokenizer::removeExceptionSpecifications(), Tokenizer::removeMacroInVarDecl(), Tokenizer::removeMacrosInGlobalScope(), Tokenizer::removeRedundantAssignment(), Tokenizer::removeRedundantConditions(), Tokenizer::removeRedundantFor(), TemplateSimplifier::removeTemplate(), Tokenizer::removeUnnecessaryQualification(), CheckLeakAutoVar::ret(), CheckAutoVariables::returnPointerToLocalArray(), CheckAutoVariables::returnReference(), CheckAutoVariables::returnTemporary(), Scope::Scope(), Tokenizer::setVarId(), setVarIdClassDeclaration(), setVarIdParseDeclaration(), setVarIdStructMembers(), EnumValue::simplify(), Tokenizer::simplifyAddBracesPair(), Tokenizer::simplifyArrayAccessSyntax(), Tokenizer::simplifyAsm(), Tokenizer::simplifyAssignmentBlock(), Tokenizer::simplifyAssignmentInFunctionCall(), Tokenizer::simplifyAttribute(), Tokenizer::simplifyBitfields(), Tokenizer::simplifyBorland(), Tokenizer::simplifyBuiltinExpect(), TemplateSimplifier::simplifyCalculations(), Tokenizer::simplifyCallingConvention(), Tokenizer::simplifyCasts(), Tokenizer::simplifyCharAt(), CheckMemoryLeakInFunction::simplifycode(), Tokenizer::simplifyComma(), Tokenizer::simplifyComparisonOrder(), Tokenizer::simplifyCompoundAssignment(), Preprocessor::simplifyCondition(), Tokenizer::simplifyConditionOperator(), Tokenizer::simplifyConditions(), Tokenizer::simplifyConst(), Tokenizer::simplifyConstTernaryOp(), Tokenizer::simplifyEmptyNamespaces(), Tokenizer::simplifyEnum(), Tokenizer::simplifyErrNoInWhile(), Tokenizer::simplifyExternC(), Tokenizer::simplifyFlowControl(), Tokenizer::simplifyFuncInWhile(), Tokenizer::simplifyFunctionParameters(), Tokenizer::simplifyFunctionPointers(), Tokenizer::simplifyFunctionReturn(), Tokenizer::simplifyGoto(), Tokenizer::simplifyIfAssign(), Tokenizer::simplifyIfNot(), Tokenizer::simplifyIfNotNull(), Tokenizer::simplifyIfSameInnerCondition(), Tokenizer::simplifyInitVar(), Tokenizer::simplifyKeyword(), Tokenizer::simplifyKnownVariables(), Tokenizer::simplifyKnownVariablesGetData(), Tokenizer::simplifyKnownVariablesSimplify(), Tokenizer::simplifyLabelsCaseDefault(), Tokenizer::simplifyLogicalOperators(), Tokenizer::simplifyMathExpressions(), Tokenizer::simplifyMathFunctions(), Tokenizer::simplifyMicrosoftMemoryFunctions(), Tokenizer::simplifyMicrosoftMFC(), Tokenizer::simplifyMicrosoftStringFunctions(), Tokenizer::simplifyMulAndParens(), Tokenizer::simplifyNamespaceStd(), Tokenizer::simplifyNestedStrcat(), Tokenizer::simplifyNull(), TemplateSimplifier::simplifyNumericCalculations(), Tokenizer::simplifyOperatorName(), Tokenizer::simplifyParameterVoid(), Tokenizer::simplifyPlatformTypes(), Tokenizer::simplifyPointerToStandardType(), Tokenizer::simplifyQtSignalsSlots(), Tokenizer::simplifyRealloc(), Tokenizer::simplifyRedundantParentheses(), Tokenizer::simplifyReference(), Tokenizer::simplifyRoundCurlyParentheses(), Tokenizer::simplifySizeof(), Tokenizer::simplifyStd(), Tokenizer::simplifyStdType(), Tokenizer::simplifyStructDecl(), Tokenizer::simplifyStructInit(), TemplateSimplifier::simplifyTemplateInstantiations(), Tokenizer::simplifyTemplates(), Tokenizer::simplifyTokenList(), Tokenizer::simplifyTypedef(), Tokenizer::simplifyUndefinedSizeArray(), Tokenizer::simplifyVarDecl(), Tokenizer::simplifyVariableMultipleAssign(), Tokenizer::simplifyWhile0(), CheckStl::size(), CheckOther::sizeofCalculation(), CheckOther::sizeofsizeof(), skipBracketsAndMembers(), skipPointers(), skipScopeIdentifiers(), skipTernaryOp(), splitDefinitionFromTypedef(), CheckStl::stlBoundaries(), CheckStl::stlOutOfBounds(), CheckStl::string_c_str(), CheckOther::strPlusChar(), SymbolDatabase::SymbolDatabase(), TemplateSimplifier::templateParameters(), Tokenizer::tokenize(), UninitVar::use(), TemplateSimplifier::useDefaultArgumentValues(), CheckStl::uselessCalls(), Tokenizer::validate(), CheckMemoryLeakInClass::variable(), CheckClass::virtualDestructor(), CheckOther::warningOldStylePointerCast(), and CheckBufferOverrun::writeOutsideBufferSize().

void Token::move ( Token srcStart,
Token srcEnd,
Token newLocation 
) [static]

Move srcStart and srcEnd tokens and all tokens between them into new a location.

Only links between tokens are changed.

Parameters:
srcStartThis is the first token to be moved
srcEndThe last token to be moved
newLocationsrcStart will be placed after this token.

[newLocation] -> b -> c -> [srcStart] -> [srcEnd] -> f

Definition at line 796 of file token.cpp.

References _progressValue, next(), and previous().

Referenced by Tokenizer::simplifyFuncInWhile(), Tokenizer::simplifyMicrosoftMemoryFunctions(), Tokenizer::simplifyNestedStrcat(), and Tokenizer::simplifyRealloc().

int Token::multiCompare ( const Token tok,
const char *  haystack,
const char *  needle 
) [static]

Needle is build from multiple alternatives.

If one of them is equal to haystack, return value is 1. If there are no matches, but one alternative to needle is empty string, return value is 0. If needle was not found, return value is -1.

Parameters:
tokCurrent token
haystacke.g. "one|two" or "|one|two"
needlee.g. "one", "two" or "invalid"
Returns:
1 if needle is found from the haystack 0 if needle was empty string -1 if needle was not found

Definition at line 352 of file token.cpp.

References isConstOp(), isOp(), and multiComparePercent().

Referenced by Match().

Token* Token::next ( ) const [inline]

Definition at line 323 of file token.h.

Referenced by Function::addArguments(), SymbolDatabase::addGlobalFunction(), SymbolDatabase::addNewFunction(), UninitVar::analyseFunctions(), Function::argsMatch(), Variable::arrayDimensions(), CheckBufferOverrun::arrayIndexInForLoop(), CheckBufferOverrun::arrayIndexThenCheck(), Tokenizer::arraySize(), CheckAssignIf::assignIf(), CheckAssignIf::assignIfParseScope(), assignProgressValues(), CheckAutoVariables::autoVariables(), bailoutIfSwitch(), CheckMemoryLeakInFunction::call_func(), CheckMemoryLeakInFunction::check(), CheckMemoryLeakNoVar::check(), CheckOther::checkAssignBoolToPointer(), CheckOther::checkAssignmentInAssert(), CheckStl::checkAutoPointer(), CheckOther::checkBitwiseOnBoolean(), CheckBoost::checkBoostForeachModification(), CheckBufferOverrun::checkBufferAllocatedWithStrlen(), CheckOther::checkCastIntToCharAndBack(), CheckOther::checkCCTypeFunctions(), CheckOther::checkCharVariable(), CheckOther::checkComparisonOfBoolExpressionWithInt(), CheckOther::checkComparisonOfBoolWithBool(), CheckOther::checkComparisonOfBoolWithInt(), CheckOther::checkComparisonOfFuncReturningBool(), CheckClass::checkConstFunc(), CheckIO::checkCoutCerrMisusage(), CheckOther::checkDoubleFree(), CheckOther::checkDuplicateBranch(), CheckOther::checkDuplicateExpression(), CheckOther::checkDuplicateIf(), CheckOther::checkExpressionRange(), CppCheck::checkFile(), CheckIO::checkFileUsage(), CheckBufferOverrun::checkFunctionParameter(), checkFunctionUsage(), CheckUnusedVar::checkFunctionVariableUsage_iterateScopes(), CheckBufferOverrun::checkGlobalAndLocalVariable(), CheckUninitVar::checkIfForWhileHead(), CheckOther::checkIncompleteArrayFill(), CheckOther::checkIncompleteStatement(), CheckOther::checkIncorrectLogicOperator(), CheckOther::checkIncorrectStringCompare(), CheckOther::checkIncrementBoolean(), CheckOther::checkInnerScope(), CheckBufferOverrun::checkInsecureCmdLineArgs(), CheckOther::checkInvalidFree(), CheckUninitVar::checkLoopBody(), CheckOther::checkMathFunctions(), CheckOther::checkMemsetZeroBytes(), CheckInternal::checkMissingPercentCharacter(), CheckOther::checkMisusedScopedObject(), CheckOther::checkModuloAlwaysTrueFalse(), CheckOther::checkNegativeBitwiseShift(), CheckOther::checkPipeParameterSize(), CheckMemoryLeakInClass::checkPublicFunctions(), CheckBufferOverrun::checkReadlinkBufferUsage(), CheckMemoryLeakInFunction::checkReallocUsage(), CheckOther::checkRedundantAssignment(), CheckOther::checkRedundantAssignmentInSwitch(), CheckOther::checkRedundantCopy(), CheckInternal::checkRedundantNextPrevious(), CheckExceptionSafety::checkRethrowCopy(), CheckClass::checkReturnPtrThis(), CheckUninitVar::checkScope(), CheckLeakAutoVar::checkScope(), ExecutionPath::checkScope(), CheckBufferOverrun::checkScope(), CheckMemoryLeakInFunction::checkScope(), EraseCheckLoop::checkScope(), CheckBufferOverrun::checkScopeForBody(), CheckUninitVar::checkScopeForVariable(), CheckOther::checkSelfAssignment(), CheckOther::checkSignOfUnsignedVariable(), CheckOther::checkSizeofForArrayParameter(), CheckOther::checkSizeofForNumericParameter(), CheckOther::checkSizeofForPointerSize(), CheckOther::checkSleepTimeInterval(), CheckBufferOverrun::checkSprintfCall(), CheckUnusedVar::checkStructMemberUsage(), CheckBufferOverrun::checkStructVariable(), CheckMemoryLeakStructMember::checkStructVariable(), CheckOther::checkSuspiciousCaseInSwitch(), CheckOther::checkSuspiciousEqualityComparison(), CheckOther::checkSuspiciousStringCompare(), CheckOther::checkSwitchCaseFallThrough(), CheckInternal::checkTokenMatchPatterns(), CheckInternal::checkTokenSimpleMatchPatterns(), CheckInternal::checkUnknownPattern(), CheckOther::checkUnreachableCode(), CheckOther::checkUnsignedDivision(), CheckOther::checkVarFuncNullUB(), Scope::checkVariable(), CheckOther::checkVariableScope(), CheckIO::checkWrongPrintfScanfArguments(), CheckOther::checkZeroDivision(), CheckOther::clarifyCalculation(), CheckOther::clarifyCondition(), CheckOther::clarifyStatement(), TemplateSimplifier::cleanupAfterSimplify(), PreprocessorMacro::code(), Tokenizer::combineOperators(), Tokenizer::combineStrings(), CheckAssignIf::comparison(), CheckOther::complexDuplicateExpressionCheck(), Tokenizer::concatenateDoubleSharp(), Tokenizer::concatenateNegativeNumberAndAnyPositive(), conditionAlwaysTrueOrFalse(), CheckClass::copyconstructors(), Tokenizer::copyTokens(), countMinArgs(), TokenList::createAst(), Tokenizer::createLinks(), Tokenizer::createLinks2(), Tokenizer::createSymbolDatabase(), CheckExceptionSafety::deallocThrow(), Tokenizer::deleteInvalidTypedef(), deleteNext(), Tokenizer::deleteSymbolDatabase(), TokenList::deleteTokens(), CheckExceptionSafety::destructors(), doAssignment(), Tokenizer::duplicateDefinition(), Tokenizer::duplicateTypedef(), Tokenizer::elseif(), CheckStl::erase(), Tokenizer::eraseDeadCode(), eraseTokens(), Variable::evaluate(), TemplateSimplifier::expandSpecialized(), TemplateSimplifier::expandTemplate(), expressionHasSideEffects(), findClosingBracket(), CheckMemoryLeakInFunction::findleak(), findmatch(), SymbolDatabase::findScope(), findsimplematch(), SymbolDatabase::findType(), for_condition(), for_init(), CheckMemoryLeak::functionArgAlloc(), CheckMemoryLeak::functionReturnType(), CheckMemoryLeak::getAllocationType(), Preprocessor::getcfgs(), CheckMemoryLeakInFunction::getcode(), CheckMemoryLeak::getDeallocationType(), CheckMemoryLeak::getReallocationType(), TemplateSimplifier::getTemplateDeclarations(), TemplateSimplifier::getTemplateInstantiations(), Scope::getVariableList(), CheckClass::hasAllocation(), CheckClass::hasAssignSelf(), TemplateSimplifier::hasComplicatedSyntaxErrorsInTemplates(), Tokenizer::hasEnumsWithTypedef(), CheckStl::if_find(), if_findCompare(), Type::initBaseInfo(), CheckClass::initializationListUsage(), CheckClass::initializerListOrder(), CheckClass::initializeVarList(), Tokenizer::initVar(), insertToken(), TokenList::insertTokens(), TemplateSimplifier::instantiateMatch(), CheckOther::invalidFunctionUsage(), CheckOther::invalidPointerCast(), CheckIO::invalidScanf(), CheckBufferOverrun::isArrayOfStruct(), SymbolDatabase::isFunction(), Tokenizer::isFunctionParameterPassedByValue(), isKnownType(), CheckMemoryLeakStructMember::isMalloc(), CheckNullPointer::isPointerDeRef(), Scope::isVariableDeclaration(), CheckUninitVar::isVariableUsage(), CheckStl::iterators(), Match(), CheckStl::mismatchingContainers(), CheckStl::missingComparison(), move(), CheckAssignIf::multiCondition(), nextArgument(), CheckClass::noMemset(), CheckNonReentrantFunctions::nonReentrantFunctions(), CheckNullPointer::nullConstantDereference(), CheckNullPointer::nullPointerByCheckAndDeRef(), CheckNullPointer::nullPointerByDeRefAndChec(), CheckNullPointer::nullPointerDefaultArgument(), CheckNullPointer::nullPointerLinkedList(), CheckNullPointer::nullPointerStructByDeRefAndChec(), CheckObsoleteFunctions::obsoleteFunctions(), CheckOther::oppositeInnerCondition(), UninitVar::parse(), EraseCheckLoop::parse(), Nullpointer::parse(), ExecutionPathBufferOverrun::parse(), CheckBufferOverrun::parse_for_body(), CheckMemoryLeakInFunction::parse_noreturn(), ExecutionPath::parseCondition(), UninitVar::parseCondition(), Nullpointer::parseCondition(), UninitVar::parseLoopBody(), Nullpointer::parseLoopBody(), UninitVar::parserhs(), CheckUnusedFunctions::parseTokens(), Check64BitPortability::pointerassignment(), CheckPostfixOperator::postfixOperator(), PreprocessorMacro::PreprocessorMacro(), Tokenizer::printUnknownTypes(), processFunc(), CheckStl::pushback(), CheckStl::redundantCondition(), CheckOther::redundantGetAndSetUserId(), Tokenizer::removeExceptionSpecifications(), Tokenizer::removeMacroInVarDecl(), Tokenizer::removeMacrosInGlobalScope(), Tokenizer::removeRedundantAssignment(), Tokenizer::removeRedundantConditions(), Tokenizer::removeRedundantFor(), Tokenizer::removeRedundantSemicolons(), TemplateSimplifier::removeTemplate(), Tokenizer::removeUnnecessaryQualification(), replace(), CheckLeakAutoVar::ret(), CheckAutoVariables::returnPointerToLocalArray(), CheckAutoVariables::returnReference(), CheckAutoVariables::returnTemporary(), Scope::Scope(), Tokenizer::setVarId(), setVarIdClassDeclaration(), setVarIdClassFunction(), setVarIdParseDeclaration(), setVarIdStructMembers(), simpleMatch(), EnumValue::simplify(), Tokenizer::simplifyAddBraces(), Tokenizer::simplifyAddBracesPair(), Tokenizer::simplifyAddBracesToCommand(), Tokenizer::simplifyArrayAccessSyntax(), Tokenizer::simplifyAsm(), Tokenizer::simplifyAssignmentBlock(), Tokenizer::simplifyAssignmentInFunctionCall(), Tokenizer::simplifyAttribute(), Tokenizer::simplifyBitfields(), Tokenizer::simplifyBorland(), Tokenizer::simplifyBuiltinExpect(), TemplateSimplifier::simplifyCalculations(), Tokenizer::simplifyCallingConvention(), Tokenizer::simplifyCasts(), Tokenizer::simplifyCharAt(), CheckMemoryLeakInFunction::simplifycode(), Tokenizer::simplifyComma(), Tokenizer::simplifyComparisonOrder(), Tokenizer::simplifyCompoundAssignment(), Preprocessor::simplifyCondition(), Tokenizer::simplifyConditionOperator(), Tokenizer::simplifyConditions(), Tokenizer::simplifyConst(), Tokenizer::simplifyConstTernaryOp(), Tokenizer::simplifyDebugNew(), Tokenizer::simplifyDeclspec(), Tokenizer::simplifyDoublePlusAndDoubleMinus(), Tokenizer::simplifyEmptyNamespaces(), Tokenizer::simplifyEnum(), Tokenizer::simplifyErrNoInWhile(), Tokenizer::simplifyExternC(), Tokenizer::simplifyFileAndLineMacro(), Tokenizer::simplifyFlowControl(), Tokenizer::simplifyFuncInWhile(), Tokenizer::simplifyFunctionParameters(), Tokenizer::simplifyFunctionPointers(), Tokenizer::simplifyFunctionReturn(), Tokenizer::simplifyGoto(), Tokenizer::simplifyIfAssign(), Tokenizer::simplifyIfNot(), Tokenizer::simplifyIfNotNull(), Tokenizer::simplifyIfSameInnerCondition(), Tokenizer::simplifyInitVar(), Tokenizer::simplifyKeyword(), Tokenizer::simplifyKnownVariables(), Tokenizer::simplifyKnownVariablesGetData(), Tokenizer::simplifyKnownVariablesSimplify(), Tokenizer::simplifyLabelsCaseDefault(), Tokenizer::simplifyLogicalOperators(), Tokenizer::simplifyMathExpressions(), Tokenizer::simplifyMathFunctions(), Tokenizer::simplifyMicrosoftMemoryFunctions(), Tokenizer::simplifyMicrosoftMFC(), Tokenizer::simplifyMicrosoftStringFunctions(), Tokenizer::simplifyMulAndParens(), Tokenizer::simplifyNamespaceStd(), Tokenizer::simplifyNestedStrcat(), Tokenizer::simplifyNull(), TemplateSimplifier::simplifyNumericCalculations(), Tokenizer::simplifyOperatorName(), Tokenizer::simplifyParameterVoid(), Tokenizer::simplifyPlatformTypes(), Tokenizer::simplifyPointerToStandardType(), Tokenizer::simplifyQtSignalsSlots(), Tokenizer::simplifyRealloc(), Tokenizer::simplifyRedundantParentheses(), Tokenizer::simplifyReference(), Tokenizer::simplifyReturnStrncat(), Tokenizer::simplifyRoundCurlyParentheses(), Tokenizer::simplifySizeof(), Tokenizer::simplifySQL(), Tokenizer::simplifyStd(), Tokenizer::simplifyStdType(), Tokenizer::simplifyStructDecl(), Tokenizer::simplifyStructInit(), TemplateSimplifier::simplifyTemplateInstantiations(), TemplateSimplifier::simplifyTemplates(), Tokenizer::simplifyTemplates(), Tokenizer::simplifyTokenList(), Tokenizer::simplifyTypedef(), Tokenizer::simplifyUndefinedSizeArray(), Tokenizer::simplifyVarDecl(), Tokenizer::simplifyVariableMultipleAssign(), simplifyVarMap(), simplifyVarMapExpandValue(), Tokenizer::simplifyWhile0(), CheckStl::size(), CheckOther::sizeofCalculation(), CheckOther::sizeofsizeof(), skipPointers(), skipScopeIdentifiers(), skipTernaryOp(), splitDefinitionFromTypedef(), CheckStl::stlBoundaries(), CheckStl::stlOutOfBounds(), CheckStl::string_c_str(), stringifyList(), CheckOther::strPlusChar(), CheckOther::suspiciousSizeofCalculation(), SymbolDatabase::SymbolDatabase(), TemplateSimplifier::templateParameters(), CheckClass::thisSubtraction(), tokAt(), Tokenizer::tokenize(), Tokenizer::tokenizeCondition(), Tokenizer::unsupportedTypedef(), TemplateSimplifier::useDefaultArgumentValues(), CheckStl::uselessCalls(), Tokenizer::validate(), CheckMemoryLeakInClass::variable(), variableIsUsedInScope(), CheckClass::virtualDestructor(), CheckOther::warningOldStylePointerCast(), Variables::write(), and CheckBufferOverrun::writeOutsideBufferSize().

void Token::next ( Token nextToken) [inline, private]

Definition at line 557 of file token.h.

Token Token::operator= ( const Token ) [private]
Token* Token::previous ( ) const [inline]

Definition at line 346 of file token.h.

Referenced by Function::addArguments(), SymbolDatabase::addClassFunction(), SymbolDatabase::addNewFunction(), CheckAssignIf::assignIf(), CheckMemoryLeakInFunction::call_func(), CheckMemoryLeakNoVar::check(), CheckStl::checkAutoPointer(), CheckOther::checkComparisonOfBoolWithBool(), CheckOther::checkComparisonOfFuncReturningBool(), CheckClass::checkConst(), CheckOther::checkDuplicateIf(), CheckIO::checkFileUsage(), CheckBufferOverrun::checkGlobalAndLocalVariable(), CheckOther::checkInnerScope(), CheckOther::checkNegativeBitwiseShift(), CheckUninitVar::checkScope(), ExecutionPath::checkScope(), CheckBufferOverrun::checkScope(), CheckUninitVar::checkScopeForVariable(), CheckOther::checkSelfAssignment(), CheckOther::checkSignOfUnsignedVariable(), CheckOther::checkUnreachableCode(), CheckOther::checkVarFuncNullUB(), Scope::checkVariable(), CheckOther::checkVariableScope(), CheckOther::clarifyCalculation(), CheckOther::clarifyCondition(), CheckOther::clarifyStatement(), CheckOther::complexDuplicateExpressionCheck(), TokenList::createAst(), Tokenizer::deleteInvalidTypedef(), deleteNext(), Tokenizer::duplicateDefinition(), Tokenizer::duplicateTypedef(), Tokenizer::eraseDeadCode(), Variable::evaluate(), TemplateSimplifier::expandSpecialized(), CheckMemoryLeak::functionArgAlloc(), CheckMemoryLeakInFunction::getcode(), TemplateSimplifier::getTemplateInstantiations(), hasArrayEnd(), hasArrayEndParen(), CheckClass::initializeVarList(), insertToken(), SymbolDatabase::isFunction(), Tokenizer::isFunctionParameterPassedByValue(), Function::isImplicitlyVirtual_rec(), isint(), CheckClass::isMemberVar(), CheckUninitVar::isMemberVariableAssignment(), CheckUninitVar::isMemberVariableUsage(), isPartOfClassStructUnion(), CheckNullPointer::isPointerDeRef(), Tokenizer::IsScopeNoReturn(), CheckUninitVar::isVariableUsage(), CheckStl::iterators(), move(), CheckBufferOverrun::negativeIndex(), CheckNonReentrantFunctions::nonReentrantFunctions(), CheckNullPointer::nullConstantDereference(), CheckNullPointer::nullPointerByDeRefAndChec(), CheckNullPointer::nullPointerStructByDeRefAndChec(), CheckClass::operatorEqToSelf(), UninitVar::parse(), EraseCheckLoop::parse(), Nullpointer::parse(), ExecutionPathBufferOverrun::parse(), CheckBufferOverrun::parse_for_body(), UninitVar::parserhs(), Check64BitPortability::pointerassignment(), CheckPostfixOperator::postfixOperator(), CheckStl::pushback(), Tokenizer::removeRedundantConditions(), replace(), CheckAutoVariables::returnPointerToLocalArray(), CheckAutoVariables::returnReference(), CheckAutoVariables::returnTemporary(), Tokenizer::setVarId(), setVarIdClassDeclaration(), setVarIdParseDeclaration(), EnumValue::simplify(), Tokenizer::simplifyAddBracesPair(), Tokenizer::simplifyAddBracesToCommand(), Tokenizer::simplifyComma(), Tokenizer::simplifyCompoundAssignment(), Tokenizer::simplifyConditionOperator(), Tokenizer::simplifyConditions(), Tokenizer::simplifyConstTernaryOp(), Tokenizer::simplifyEnum(), Tokenizer::simplifyErrNoInWhile(), Tokenizer::simplifyFuncInWhile(), Tokenizer::simplifyFunctionParameters(), Tokenizer::simplifyGoto(), Tokenizer::simplifyIfAssign(), Tokenizer::simplifyIfNotNull(), Tokenizer::simplifyKnownVariables(), Tokenizer::simplifyKnownVariablesGetData(), Tokenizer::simplifyKnownVariablesSimplify(), Tokenizer::simplifyLogicalOperators(), Tokenizer::simplifyMicrosoftMemoryFunctions(), Tokenizer::simplifyMulAndParens(), Tokenizer::simplifyNestedStrcat(), TemplateSimplifier::simplifyNumericCalculations(), Tokenizer::simplifyRealloc(), Tokenizer::simplifyRedundantParentheses(), Tokenizer::simplifySizeof(), Tokenizer::simplifyStructDecl(), Tokenizer::simplifyStructInit(), TemplateSimplifier::simplifyTemplateInstantiations(), Tokenizer::simplifyTypedef(), Tokenizer::simplifyUndefinedSizeArray(), Tokenizer::simplifyVarDecl(), Tokenizer::simplifyVariableMultipleAssign(), Tokenizer::simplifyWhile0(), splitDefinitionFromTypedef(), CheckStl::string_c_str(), CheckOther::suspiciousSizeofCalculation(), SymbolDatabase::SymbolDatabase(), tokAt(), and TemplateSimplifier::useDefaultArgumentValues().

void Token::previous ( Token previousToken) [inline, private]

Definition at line 560 of file token.h.

void Token::printOut ( const char *  title = 0) const

For debugging purposes, prints token and all tokens followed by it.

Parameters:
titleTitle for the printout or use default parameter or 0 for no title.

Definition at line 955 of file token.cpp.

References stringifyList().

Referenced by CheckMemoryLeakInFunction::checkScope(), and Tokenizer::simplifyTokenList().

void Token::printOut ( const char *  title,
const std::vector< std::string > &  fileNames 
) const

For debugging purposes, prints token and all tokens followed by it.

Parameters:
titleTitle for the printout or use default parameter or 0 for no title.
fileNamesPrints out file name instead of file index. File index should match the index of the string in this vector.

Definition at line 962 of file token.cpp.

References stringifyList().

unsigned int Token::progressValue ( ) const [inline]

Get progressValue.

Definition at line 522 of file token.h.

Referenced by Tokenizer::simplifyKnownVariablesSimplify().

void Token::replace ( Token replaceThis,
Token start,
Token end 
) [static]

Replace token replaceThis with tokens between start and end, including start and end.

The replaceThis token is deleted.

Parameters:
replaceThisThis token will be deleted.
startThis will be in the place of replaceThis
endThis is also in the place of replaceThis

Definition at line 241 of file token.cpp.

References _progressValue, next(), previous(), and tokensBack.

Referenced by Tokenizer::simplifyFunctionParameters(), and Tokenizer::simplifyKnownVariables().

void Token::scope ( const Scope s) [inline]
const Scope* Token::scope ( ) const [inline]

Returns a pointer to the scope containing this token.

Definition at line 457 of file token.h.

void Token::setExpandedMacro ( bool  m) [inline]

Definition at line 272 of file token.h.

Referenced by Tokenizer::copyTokens(), and TokenList::createTokens().

bool Token::simpleMatch ( const Token tok,
const char  pattern[] 
) [static]

Match given token (or list of tokens) to a pattern list.

Possible patterns "someRandomText" If token contains "someRandomText".

Note:
Use Match() if you want to use flags in patterns

The patterns can be also combined to compare to multiple tokens at once by separating tokens with a space, e.g. ") void {" will return true if first token is ')' next token is "void" and token after that is '{'. If even one of the tokens does not match its pattern, false is returned.

Parameters:
tokList of tokens to be compared to the pattern
patternThe pattern against which the tokens are compared, e.g. "const" or ") void {".
Returns:
true if given token matches with given pattern false if given token does not match with given pattern

Definition at line 444 of file token.cpp.

References _str, and next().

Referenced by Function::addArguments(), CheckAssignIf::assignIfParseScope(), CheckAutoVariables::autoVariables(), bailoutIfSwitch(), CheckMemoryLeakInFunction::call_func(), CheckStl::checkAutoPointer(), CheckBoost::checkBoostForeachModification(), CheckOther::checkConstantFunctionParameter(), CheckClass::checkConstFunc(), CheckOther::checkDoubleFree(), CheckOther::checkDuplicateBranch(), CheckOther::checkDuplicateIf(), CheckIO::checkFileUsage(), CheckBufferOverrun::checkFunctionParameter(), CheckUnusedVar::checkFunctionVariableUsage(), CheckUnusedVar::checkFunctionVariableUsage_iterateScopes(), CheckBufferOverrun::checkGlobalAndLocalVariable(), CheckOther::checkIncompleteStatement(), CheckOther::checkInnerScope(), CheckBufferOverrun::checkInsecureCmdLineArgs(), CheckClass::checkMemsetType(), CheckOther::checkMemsetZeroBytes(), CheckInternal::checkMissingPercentCharacter(), CheckOther::checkMisusedScopedObject(), CheckMemoryLeakInFunction::checkReallocUsage(), CheckOther::checkRedundantAssignment(), CheckInternal::checkRedundantNextPrevious(), CheckExceptionSafety::checkRethrowCopy(), CheckClass::checkReturnPtrThis(), CheckLeakAutoVar::checkScope(), ExecutionPath::checkScope(), CheckBufferOverrun::checkScope(), CheckMemoryLeakInFunction::checkScope(), EraseCheckLoop::checkScope(), CheckUninitVar::checkScopeForVariable(), CheckOther::checkSizeofForPointerSize(), CheckUnusedVar::checkStructMemberUsage(), CheckBufferOverrun::checkStructVariable(), CheckMemoryLeakStructMember::checkStructVariable(), CheckOther::checkSuspiciousEqualityComparison(), CheckOther::checkSuspiciousSemicolon(), CheckOther::checkSwitchCaseFallThrough(), CheckInternal::checkTokenMatchPatterns(), CheckInternal::checkTokenSimpleMatchPatterns(), CheckInternal::checkUnknownPattern(), CheckOther::checkUnsignedDivision(), CheckOther::checkVarFuncNullUB(), Scope::checkVariable(), CheckOther::clarifyCondition(), PreprocessorMacro::code(), conditionAlwaysTrueOrFalse(), CheckExceptionSafety::deallocThrow(), CheckExceptionSafety::destructors(), Tokenizer::duplicateDefinition(), Tokenizer::duplicateTypedef(), Tokenizer::elseif(), Tokenizer::eraseDeadCode(), TemplateSimplifier::expandSpecialized(), findsimplematch(), CheckMemoryLeak::getAllocationType(), CheckMemoryLeakInFunction::getcode(), CheckMemoryLeak::getDeallocationType(), TemplateSimplifier::getTemplateDeclarations(), TemplateSimplifier::getTemplateInstantiations(), Scope::getVariableList(), hasArrayEnd(), hasArrayEndParen(), CheckClass::hasAssignSelf(), TemplateSimplifier::hasComplicatedSyntaxErrorsInTemplates(), CheckStl::if_find(), CheckClass::initializationListUsage(), CheckClass::initializeVarList(), TemplateSimplifier::instantiateMatch(), isContainerSizeSlow(), SymbolDatabase::isFunction(), isInitList(), CheckClass::isMemberVar(), CheckNullPointer::isPointerDeRef(), Tokenizer::IsScopeNoReturn(), isTypeWithoutSideEffects(), Scope::isVariableDeclaration(), CheckStl::iterators(), CheckAssignIf::multiCondition(), CheckClass::noMemset(), CheckNullPointer::nullConstantDereference(), CheckNullPointer::nullPointerByCheckAndDeRef(), CheckNullPointer::nullPointerByDeRefAndChec(), CheckNullPointer::nullPointerDefaultArgument(), CheckNullPointer::nullPointerStructByDeRefAndChec(), CheckObsoleteFunctions::obsoleteFunctions(), UninitVar::parse(), Nullpointer::parse(), CheckBufferOverrun::parse_for_body(), UninitVar::parseCondition(), UninitVar::parseLoopBody(), UninitVar::parserhs(), Check64BitPortability::pointerassignment(), PreprocessorMacro::PreprocessorMacro(), processFunc(), CheckStl::pushback(), CheckOther::redundantGetAndSetUserId(), Tokenizer::removeRedundantConditions(), Tokenizer::removeRedundantSemicolons(), TemplateSimplifier::removeTemplate(), CheckAutoVariables::returnReference(), CheckAutoVariables::returnTemporary(), Tokenizer::setVarId(), Tokenizer::simplifyAssignmentBlock(), Tokenizer::simplifyAssignmentInFunctionCall(), Tokenizer::simplifyAttribute(), Tokenizer::simplifyBitfields(), Tokenizer::simplifyBuiltinExpect(), TemplateSimplifier::simplifyCalculations(), Tokenizer::simplifyCasts(), CheckMemoryLeakInFunction::simplifycode(), Tokenizer::simplifyCompoundAssignment(), Preprocessor::simplifyCondition(), Tokenizer::simplifyConditions(), Tokenizer::simplifyDeclspec(), Tokenizer::simplifyErrNoInWhile(), Tokenizer::simplifyFlowControl(), Tokenizer::simplifyFunctionParameters(), Tokenizer::simplifyFunctionPointers(), Tokenizer::simplifyIfNotNull(), Tokenizer::simplifyIfSameInnerCondition(), Tokenizer::simplifyKnownVariablesGetData(), Tokenizer::simplifyKnownVariablesSimplify(), Tokenizer::simplifyMathExpressions(), Tokenizer::simplifyMathFunctions(), Tokenizer::simplifyMicrosoftMemoryFunctions(), Tokenizer::simplifyMicrosoftMFC(), Tokenizer::simplifyMicrosoftStringFunctions(), Tokenizer::simplifyNamespaceStd(), Tokenizer::simplifyNestedStrcat(), Tokenizer::simplifyOperatorName(), Tokenizer::simplifyQtSignalsSlots(), Tokenizer::simplifyRealloc(), Tokenizer::simplifyRedundantConsecutiveBraces(), Tokenizer::simplifyRedundantParentheses(), Tokenizer::simplifyReturnStrncat(), Tokenizer::simplifyRoundCurlyParentheses(), Tokenizer::simplifySizeof(), Tokenizer::simplifySQL(), Tokenizer::simplifyStructDecl(), Tokenizer::simplifyStructInit(), TemplateSimplifier::simplifyTemplateInstantiations(), TemplateSimplifier::simplifyTemplates(), Tokenizer::simplifyTokenList(), Tokenizer::simplifyTypedef(), Tokenizer::simplifyVarDecl(), Tokenizer::simplifyWhile0(), CheckOther::sizeofCalculation(), CheckStl::string_c_str(), CheckOther::suspiciousSizeofCalculation(), SymbolDatabase::SymbolDatabase(), Tokenizer::tokenize(), CheckStl::uselessCalls(), variableIsUsedInScope(), CheckClass::virtualDestructor(), and Variables::write().

void Token::str ( const std::string &  s)

Definition at line 150 of file token.cpp.

References _str, _varId, and update_property_info().

Referenced by Function::addArguments(), SymbolDatabase::addClassFunction(), SymbolDatabase::addGlobalFunction(), SymbolDatabase::addNewFunction(), TokenList::addtoken(), UninitVar::analyseFunctions(), analyzeType(), Function::argsMatch(), Variable::arrayDimensions(), CheckBufferOverrun::arrayIndexInForLoop(), CheckBufferOverrun::ArrayInfo::ArrayInfo(), CheckAssignIf::assignIf(), CheckAssignIf::assignIfParseScope(), CheckAutoVariables::autoVariables(), bailoutIfSwitch(), CheckMemoryLeakInFunction::call_func(), CheckMemoryLeakInFunction::check(), CheckOther::checkAssignmentInAssert(), CheckStl::checkAutoPointer(), CheckOther::checkBitwiseOnBoolean(), CheckOther::checkCastIntToCharAndBack(), CheckOther::checkCharVariable(), CheckOther::checkComparisonOfBoolExpressionWithInt(), CheckOther::checkComparisonOfBoolWithBool(), CheckOther::checkComparisonOfBoolWithInt(), CheckOther::checkComparisonOfFuncReturningBool(), CheckClass::checkConst(), CheckOther::checkExpressionRange(), CheckBufferOverrun::checkFunctionCall(), CheckBufferOverrun::checkFunctionParameter(), CheckUnusedVar::checkFunctionVariableUsage_iterateScopes(), CheckBufferOverrun::checkGlobalAndLocalVariable(), CheckOther::checkIncompleteArrayFill(), CheckOther::checkIncorrectLogicOperator(), CheckOther::checkIncrementBoolean(), CheckOther::checkInnerScope(), CheckUninitVar::checkLoopBody(), CheckOther::checkMathFunctions(), CheckClass::checkMemsetType(), CheckOther::checkMemsetZeroBytes(), CheckOther::checkPipeParameterSize(), CheckMemoryLeakInClass::checkPublicFunctions(), CheckBufferOverrun::checkReadlinkBufferUsage(), CheckOther::checkRedundantAssignment(), CheckOther::checkRedundantCopy(), CheckClass::checkReturnPtrThis(), checkRvalueExpression(), CheckUninitVar::checkScope(), ExecutionPath::checkScope(), CheckBufferOverrun::checkScope(), CheckMemoryLeakInFunction::checkScope(), EraseCheckLoop::checkScope(), CheckBufferOverrun::checkScopeForBody(), CheckUninitVar::checkScopeForVariable(), CheckOther::checkSelfAssignment(), CheckOther::checkSizeofForArrayParameter(), CheckOther::checkSizeofForPointerSize(), CheckOther::checkSleepTimeInterval(), CheckOther::checkSuspiciousCaseInSwitch(), CheckOther::checkUnreachableCode(), CheckOther::checkVarFuncNullUB(), Scope::checkVariable(), CheckOther::checkVariableScope(), CheckIO::checkWrongPrintfScanfArguments(), CheckOther::clarifyCalculation(), CheckOther::clarifyStatement(), TemplateSimplifier::cleanupAfterSimplify(), PreprocessorMacro::code(), CheckAssignIf::comparison(), conditionAlwaysTrueOrFalse(), CheckClass::constructors(), CheckClass::copyconstructors(), Tokenizer::copyTokens(), countMinArgs(), countParameters(), TokenList::createAst(), Tokenizer::createLinks2(), Tokenizer::deleteInvalidTypedef(), Nullpointer::dereference(), doAssignment(), Tokenizer::duplicateDeclarationError(), Tokenizer::duplicateDefinition(), Tokenizer::duplicateEnumError(), Tokenizer::duplicateTypedef(), Tokenizer::duplicateTypedefError(), EraseCheckLoop::end(), Tokenizer::eraseDeadCode(), Variable::evaluate(), TemplateSimplifier::expandSpecialized(), findClosingBracket(), Scope::findFunction(), SymbolDatabase::findFunction(), SymbolDatabase::findScope(), SymbolDatabase::findType(), SymbolDatabase::findVariableType(), for_condition(), for_init(), for_maxvalue(), CheckMemoryLeak::functionArgAlloc(), CheckLeakAutoVar::functionCall(), CheckMemoryLeak::getAllocationType(), Preprocessor::getcfgs(), CheckMemoryLeakInFunction::getcode(), CheckMemoryLeak::getDeallocationType(), CheckMemoryLeak::getReallocationType(), CheckClass::hasAllocation(), CheckClass::hasAssignSelf(), CheckStl::if_find(), if_findCompare(), Type::initBaseInfo(), CheckClass::initializationListUsage(), CheckClass::initializerListOrder(), CheckClass::initializeVarList(), Tokenizer::initVar(), insertToken(), TokenList::insertTokens(), CheckOther::invalidFunctionUsage(), CheckOther::invalidPointerCast(), CheckIO::invalidScanf(), CheckIO::invalidScanfFormatWidthError(), CheckClass::isBaseClassFunc(), isBool(), isChar(), isComplexType(), CheckClass::isConstMemberFunc(), SymbolDatabase::isFunction(), Tokenizer::isFunctionParameterPassedByValue(), Function::isImplicitlyVirtual_rec(), isLowerThanAnd(), isLowerThanMulDiv(), isLowerThanPlusMinus(), isLowerThanXor(), CheckClass::isMemberFunc(), CheckClass::isMemberVar(), isNonBoolStdType(), isPartOfClassStructUnion(), CheckNullPointer::isPointerDeRef(), Tokenizer::IsScopeNoReturn(), Scope::isVariableDeclaration(), CheckUninitVar::isVariableUsage(), CheckStl::iterators(), CheckLeakAutoVar::leakIfAllocated(), linkBrackets(), Match(), CheckOther::mathfunctionCallError(), CheckStl::mismatchingContainers(), nextArgument(), CheckClass::noMemset(), CheckNonReentrantFunctions::nonReentrantFunctions(), CheckNullPointer::nullConstantDereference(), CheckNullPointer::nullPointerByCheckAndDeRef(), CheckNullPointer::nullPointerByDeRefAndChec(), CheckNullPointer::nullPointerStructByDeRefAndChec(), TokenStrEquals::operator()(), CheckClass::operatorEqToSelf(), CheckOther::oppositeInnerCondition(), UninitVar::parse(), EraseCheckLoop::parse(), Nullpointer::parse(), CheckBufferOverrun::parse_for_body(), UninitVar::parseCondition(), Nullpointer::parseCondition(), CheckNullPointer::parseFunctionCall(), UninitVar::parseLoopBody(), UninitVar::parserhs(), CheckUnusedFunctions::parseTokens(), PreprocessorMacro::PreprocessorMacro(), SymbolDatabase::printOut(), Tokenizer::printUnknownTypes(), SymbolDatabase::printVariable(), processFunc(), CheckStl::pushback(), CheckStl::redundantCondition(), Tokenizer::removeMacroInVarDecl(), Tokenizer::removeMacrosInGlobalScope(), Tokenizer::removeRedundantFor(), Tokenizer::removeUnnecessaryQualification(), CheckAutoVariables::returnPointerToLocalArray(), CheckAutoVariables::returnReference(), CheckAutoVariables::returnTemporary(), Scope::Scope(), Tokenizer::setVarId(), setVarIdParseDeclaration(), setVarIdStructMembers(), EnumValue::simplify(), Tokenizer::simplifyAddBracesPair(), Tokenizer::simplifyAddBracesToCommand(), Tokenizer::simplifyAsm(), Tokenizer::simplifyAssignmentBlock(), Tokenizer::simplifyBitfields(), TemplateSimplifier::simplifyCalculations(), CheckMemoryLeakInFunction::simplifycode(), Tokenizer::simplifyComma(), Tokenizer::simplifyComparisonOrder(), Tokenizer::simplifyConditionOperator(), Tokenizer::simplifyConditions(), Tokenizer::simplifyConstTernaryOp(), Tokenizer::simplifyEnum(), Tokenizer::simplifyErrNoInWhile(), Tokenizer::simplifyFuncInWhile(), Tokenizer::simplifyFunctionParameters(), Tokenizer::simplifyFunctionPointers(), Tokenizer::simplifyFunctionReturn(), Tokenizer::simplifyGoto(), Tokenizer::simplifyIfAssign(), Tokenizer::simplifyInitVar(), Tokenizer::simplifyKnownVariables(), Tokenizer::simplifyKnownVariablesSimplify(), Tokenizer::simplifyLogicalOperators(), Tokenizer::simplifyMulAndParens(), TemplateSimplifier::simplifyNumericCalculations(), Tokenizer::simplifyOperatorName(), Tokenizer::simplifyRedundantParentheses(), Tokenizer::simplifySizeof(), Tokenizer::simplifySQL(), Tokenizer::simplifyStructDecl(), Tokenizer::simplifyStructInit(), TemplateSimplifier::simplifyTemplateInstantiations(), Tokenizer::simplifyTypedef(), Tokenizer::simplifyUndefinedSizeArray(), Tokenizer::simplifyVarDecl(), Tokenizer::simplifyVariableMultipleAssign(), simplifyVarMapExpandValue(), Tokenizer::simplifyWhile0(), CheckStl::size(), CheckStl::sizeError(), Tokenizer::sizeOfType(), skipBrackets(), skipBracketsAndMembers(), skipScopeIdentifiers(), skipTernaryOp(), splitDefinitionFromTypedef(), CheckOther::SuspiciousSemicolonError(), SymbolDatabase::SymbolDatabase(), TemplateSimplifier::templateParameters(), Tokenizer::unhandled_macro_class_x_y(), Tokenizer::unsupportedTypedef(), TemplateSimplifier::useDefaultArgumentValues(), CheckMemoryLeakInClass::variable(), CheckClass::virtualDestructor(), and CheckIO::wrongPrintfScanfArgumentsError().

const std::string& Token::str ( ) const [inline]
const std::string & Token::strAt ( int  index) const

Definition at line 297 of file token.cpp.

References _str, and tokAt().

Referenced by SymbolDatabase::addNewFunction(), Function::argsMatch(), CheckBufferOverrun::arrayIndexInForLoop(), CheckAssignIf::assignIf(), CheckAssignIf::assignIfParseScope(), CheckMemoryLeakInFunction::call_func(), CheckOther::checkAlwaysTrueOrFalseStringCompare(), CheckOther::checkAssignmentInAssert(), CheckOther::checkComparisonOfFuncReturningBool(), CheckClass::checkConstFunc(), CheckOther::checkDuplicateExpression(), CheckOther::checkDuplicateIf(), CheckIO::checkFileUsage(), CheckBufferOverrun::checkFunctionCall(), CheckBufferOverrun::checkFunctionParameter(), CheckUnusedVar::checkFunctionVariableUsage_iterateScopes(), CheckOther::checkIncompleteArrayFill(), CheckOther::checkIncorrectLogicOperator(), CheckOther::checkInnerScope(), CheckBufferOverrun::checkInsecureCmdLineArgs(), CheckClass::checkMemsetType(), CheckOther::checkModuloAlwaysTrueFalse(), CheckOther::checkNegativeBitwiseShift(), CheckMemoryLeakInClass::checkPublicFunctions(), CheckBufferOverrun::checkReadlinkBufferUsage(), CheckOther::checkRedundantAssignment(), CheckOther::checkRedundantAssignmentInSwitch(), CheckOther::checkRedundantCopy(), CheckClass::checkReturnPtrThis(), checkRvalueExpression(), CheckBufferOverrun::checkScope(), CheckUninitVar::checkScopeForVariable(), CheckOther::checkSignOfUnsignedVariable(), CheckUnusedVar::checkStructMemberUsage(), CheckOther::checkSuspiciousEqualityComparison(), CheckOther::checkSuspiciousStringCompare(), CheckOther::checkUnreachableCode(), CheckOther::checkVariableScope(), CheckIO::checkWrongPrintfScanfArguments(), CheckOther::clarifyCalculation(), PreprocessorMacro::code(), CheckAssignIf::comparison(), conditionAlwaysTrueOrFalse(), doAssignment(), Tokenizer::duplicateTypedef(), Variable::evaluate(), PreprocessorMacro::expandInnerMacros(), Scope::findFunction(), SymbolDatabase::findFunction(), SymbolDatabase::findScope(), SymbolDatabase::findType(), SymbolDatabase::findVariableType(), for_condition(), for_init(), Preprocessor::getcfgs(), Preprocessor::getcode(), CheckMemoryLeakInFunction::getcode(), TemplateSimplifier::getTemplateNamePosition(), CheckClass::hasAssignSelf(), CheckClass::initializerListOrder(), CheckClass::initializeVarList(), Tokenizer::initVar(), isComplexType(), SymbolDatabase::isFunction(), CheckUninitVar::isMemberVariableAssignment(), CheckUninitVar::isMemberVariableUsage(), isPartOfClassStructUnion(), CheckNullPointer::isPointerDeRef(), Scope::isVariableDeclaration(), CheckUninitVar::isVariableUsage(), CheckStl::iterators(), CheckOther::mathfunctionCallError(), CheckStl::mismatchingContainers(), CheckAssignIf::multiCondition(), CheckBufferOverrun::negativeIndex(), CheckClass::noMemset(), CheckNullPointer::nullConstantDereference(), CheckOther::oppositeInnerCondition(), UninitVar::parse(), ExecutionPathBufferOverrun::parse(), UninitVar::parserhs(), Check64BitPortability::pointerassignment(), SymbolDatabase::printOut(), Tokenizer::removeMacrosInGlobalScope(), CheckAutoVariables::returnTemporary(), CheckMemoryLeakInFunction::simplifycode(), Preprocessor::simplifyCondition(), Tokenizer::simplifyEnum(), Tokenizer::simplifyKnownVariables(), Tokenizer::simplifyKnownVariablesGetData(), Tokenizer::simplifyKnownVariablesSimplify(), Tokenizer::simplifyNestedStrcat(), TemplateSimplifier::simplifyNumericCalculations(), TemplateSimplifier::simplifyTemplateInstantiations(), Tokenizer::simplifyTypedef(), Tokenizer::simplifyVarDecl(), splitDefinitionFromTypedef(), CheckOther::suspiciousSizeofCalculation(), SymbolDatabase::SymbolDatabase(), CheckClass::thisSubtraction(), and Tokenizer::unhandled_macro_class_x_y().

void Token::stringify ( std::ostream &  os,
bool  varid,
bool  attributes 
) const

Stringify a token.

Parameters:
osThe result is shifted into that output stream
varidPrint varids. (Style: "varname@id")
attributesPrint attributes of tokens like "unsigned" in front of it.

Definition at line 969 of file token.cpp.

References _str, _varId, isLong(), isSigned(), and isUnsigned().

Referenced by stringifyList().

std::string Token::stringifyList ( bool  varid,
bool  attributes,
bool  linenumbers,
bool  linebreaks,
bool  files,
const std::vector< std::string > *  fileNames = 0,
const Token end = 0 
) const

Stringify a list of token, from current instance on.

Parameters:
varidPrint varids. (Style: "varname@id")
attributesPrint attributes of tokens like "unsigned" in front of it.
linenumbersPrint line number in front of each line
linebreaksInsert
into string when line number changes
filesprint Files as numbers or as names (if fileNames is given)
fileNamesVector of filenames. Used (if given) to print filenames as strings instead of numbers.
endStringification ends before this token is reached. 0 to stringify until end of list.
Returns:
Stringified token list as a string

Definition at line 993 of file token.cpp.

References _fileIndex, _linenr, fileIndex(), linenr(), next(), and stringify().

Referenced by CheckOther::checkDuplicateIf(), CheckMemoryLeakInFunction::checkScope(), printOut(), Tokenizer::simplifyAsm(), Tokenizer::simplifyMathExpressions(), Tokenizer::simplifySQL(), and stringifyList().

std::string Token::stringifyList ( const Token end,
bool  attributes = true 
) const

Definition at line 1051 of file token.cpp.

References stringifyList().

std::string Token::stringifyList ( bool  varid = false) const

Definition at line 1056 of file token.cpp.

References stringifyList().

std::string Token::strValue ( ) const

This can be called only for tokens that are strings, else the assert() is called.

If Token is e.g. '"hello"', this will return 'hello' (removing the double quotes).

Returns:
String value

Definition at line 166 of file token.cpp.

References _str, _type, and eString.

Referenced by CheckIO::checkFileUsage(), CheckInternal::checkMissingPercentCharacter(), CheckBufferOverrun::checkSprintfCall(), CheckInternal::checkTokenMatchPatterns(), CheckInternal::checkTokenSimpleMatchPatterns(), CheckInternal::checkUnknownPattern(), getCharAt(), getStrLength(), and CheckNullPointer::parseFunctionCall().

const Token * Token::tokAt ( int  index) const

Returns token in given index, related to this token.

For example index 1 would return next token, and 2 would return next from that one.

Definition at line 274 of file token.cpp.

References next(), and previous().

Referenced by Function::addArguments(), SymbolDatabase::addClassFunction(), UninitVar::analyseFunctions(), Function::argsMatch(), CheckBufferOverrun::arrayIndexInForLoop(), Tokenizer::arraySize(), CheckAssignIf::assignIf(), CheckAssignIf::assignIfParseScope(), CheckAutoVariables::autoVariables(), CheckMemoryLeakInFunction::call_func(), CheckNullPointer::CanFunctionAssignPointer(), CheckOther::checkAlwaysTrueOrFalseStringCompare(), CheckOther::checkAssignmentInAssert(), CheckStl::checkAutoPointer(), CheckBoost::checkBoostForeachModification(), CheckOther::checkComparisonOfBoolExpressionWithInt(), CheckOther::checkComparisonOfBoolWithInt(), CheckClass::checkConstFunc(), CheckOther::checkDoubleFree(), CheckOther::checkDuplicateExpression(), CheckOther::checkDuplicateIf(), CheckIO::checkFileUsage(), CheckBufferOverrun::checkFunctionCall(), CheckBufferOverrun::checkFunctionParameter(), CheckUnusedVar::checkFunctionVariableUsage_iterateScopes(), CheckOther::checkIncompleteArrayFill(), CheckOther::checkIncompleteStatement(), CheckOther::checkIncorrectLogicOperator(), CheckOther::checkInnerScope(), CheckBufferOverrun::checkInsecureCmdLineArgs(), CheckOther::checkMathFunctions(), CheckInternal::checkMissingPercentCharacter(), CheckOther::checkModuloAlwaysTrueFalse(), CheckOther::checkPipeParameterSize(), CheckMemoryLeakInClass::checkPublicFunctions(), CheckBufferOverrun::checkReadlinkBufferUsage(), CheckMemoryLeakInFunction::checkReallocUsage(), CheckOther::checkRedundantAssignment(), CheckOther::checkRedundantCopy(), CheckClass::checkReturnPtrThis(), CheckLeakAutoVar::checkScope(), ExecutionPath::checkScope(), CheckBufferOverrun::checkScope(), CheckMemoryLeakInFunction::checkScope(), EraseCheckLoop::checkScope(), CheckBufferOverrun::checkScopeForBody(), CheckUninitVar::checkScopeForVariable(), CheckOther::checkSelfAssignment(), CheckOther::checkSignOfUnsignedVariable(), CheckOther::checkSizeofForPointerSize(), CheckOther::checkSleepTimeInterval(), CheckBufferOverrun::checkSprintfCall(), CheckUnusedVar::checkStructMemberUsage(), CheckBufferOverrun::checkStructVariable(), CheckOther::checkSuspiciousEqualityComparison(), CheckOther::checkSuspiciousStringCompare(), CheckInternal::checkTokenMatchPatterns(), CheckInternal::checkTokenSimpleMatchPatterns(), CheckInternal::checkUnknownPattern(), CheckOther::checkUnreachableCode(), CheckOther::checkVarFuncNullUB(), Scope::checkVariable(), CheckOther::checkVariableScope(), CheckIO::checkWrongPrintfScanfArguments(), CheckOther::clarifyCalculation(), CheckOther::clarifyCondition(), CheckOther::clarifyStatement(), TemplateSimplifier::cleanupAfterSimplify(), CheckAssignIf::comparison(), conditionAlwaysTrueOrFalse(), CheckClass::copyconstructors(), countParameters(), doAssignment(), Tokenizer::duplicateDefinition(), Tokenizer::duplicateTypedef(), CheckStl::erase(), Tokenizer::eraseDeadCode(), PreprocessorMacro::expandInnerMacros(), TemplateSimplifier::expandSpecialized(), Scope::findFunction(), SymbolDatabase::findFunction(), CheckMemoryLeakInFunction::findleak(), SymbolDatabase::findScope(), SymbolDatabase::findType(), for3(), for_init(), CheckMemoryLeak::functionArgAlloc(), CheckLeakAutoVar::functionCall(), CheckMemoryLeak::getAllocationType(), Preprocessor::getcfgs(), CheckMemoryLeakInFunction::getcode(), TemplateSimplifier::getTemplateInstantiations(), CheckClass::hasAllocation(), hasArrayEndParen(), CheckClass::hasAssignSelf(), TemplateSimplifier::hasComplicatedSyntaxErrorsInTemplates(), CheckStl::if_find(), Type::initBaseInfo(), CheckClass::initializationListUsage(), CheckClass::initializerListOrder(), CheckClass::initializeVarList(), Tokenizer::initVar(), CheckOther::invalidFunctionUsage(), CheckOther::invalidPointerCast(), CheckIO::invalidScanf(), CheckBufferOverrun::isArrayOfStruct(), isComplexType(), isContainerSizeSlow(), Tokenizer::isFunctionParameterPassedByValue(), CheckClass::isMemberVar(), CheckUninitVar::isMemberVariableAssignment(), CheckNullPointer::isPointerDeRef(), Tokenizer::IsScopeNoReturn(), Scope::isVariableDeclaration(), CheckUninitVar::isVariableUsage(), CheckStl::iterators(), linkAt(), CheckStl::mismatchingContainers(), CheckStl::missingComparison(), CheckAssignIf::multiCondition(), CheckClass::noMemset(), CheckNullPointer::nullConstantDereference(), CheckNullPointer::nullPointerByCheckAndDeRef(), CheckNullPointer::nullPointerByDeRefAndChec(), CheckNullPointer::nullPointerLinkedList(), CheckNullPointer::nullPointerStructByDeRefAndChec(), CheckOther::oppositeInnerCondition(), UninitVar::parse(), EraseCheckLoop::parse(), Nullpointer::parse(), ExecutionPathBufferOverrun::parse(), CheckNullPointer::parseFunctionCall(), UninitVar::parseLoopBody(), UninitVar::parserhs(), CheckUnusedFunctions::parseTokens(), SymbolDatabase::printOut(), processFunc(), CheckStl::pushback(), CheckStl::redundantCondition(), Tokenizer::removeMacrosInGlobalScope(), Tokenizer::removeRedundantFor(), Tokenizer::removeUnnecessaryQualification(), CheckAutoVariables::returnReference(), Scope::Scope(), Tokenizer::setVarId(), setVarIdParseDeclaration(), setVarIdStructMembers(), Tokenizer::simplifyAssignmentBlock(), Tokenizer::simplifyAssignmentInFunctionCall(), Tokenizer::simplifyBitfields(), Tokenizer::simplifyBuiltinExpect(), Tokenizer::simplifyCasts(), CheckMemoryLeakInFunction::simplifycode(), Tokenizer::simplifyComparisonOrder(), Tokenizer::simplifyConditionOperator(), Tokenizer::simplifyConstTernaryOp(), Tokenizer::simplifyEnum(), Tokenizer::simplifyErrNoInWhile(), Tokenizer::simplifyFuncInWhile(), Tokenizer::simplifyFunctionParameters(), Tokenizer::simplifyFunctionReturn(), Tokenizer::simplifyGoto(), Tokenizer::simplifyIfNotNull(), Tokenizer::simplifyIfSameInnerCondition(), Tokenizer::simplifyKnownVariables(), Tokenizer::simplifyKnownVariablesGetData(), Tokenizer::simplifyKnownVariablesSimplify(), Tokenizer::simplifyMathExpressions(), Tokenizer::simplifyMicrosoftMemoryFunctions(), Tokenizer::simplifyMulAndParens(), Tokenizer::simplifyNestedStrcat(), TemplateSimplifier::simplifyNumericCalculations(), Tokenizer::simplifyOperatorName(), Tokenizer::simplifyRealloc(), Tokenizer::simplifyRedundantParentheses(), Tokenizer::simplifyReference(), Tokenizer::simplifyReturnStrncat(), Tokenizer::simplifySizeof(), Tokenizer::simplifySQL(), Tokenizer::simplifyStructDecl(), Tokenizer::simplifyStructInit(), TemplateSimplifier::simplifyTemplateInstantiations(), Tokenizer::simplifyTemplates(), Tokenizer::simplifyTokenList(), Tokenizer::simplifyTypedef(), Tokenizer::simplifyUndefinedSizeArray(), Tokenizer::simplifyVarDecl(), Tokenizer::simplifyVariableMultipleAssign(), CheckStl::size(), CheckOther::sizeofCalculation(), skipBracketsAndMembers(), skipScopeIdentifiers(), splitDefinitionFromTypedef(), CheckStl::stlOutOfBounds(), strAt(), CheckStl::string_c_str(), SymbolDatabase::SymbolDatabase(), TemplateSimplifier::templateParameters(), TemplateSimplifier::useDefaultArgumentValues(), and CheckClass::virtualDestructor().

Token* Token::tokAt ( int  index) [inline]

Definition at line 89 of file token.h.

Type Token::type ( ) const [inline]
void Token::type ( Type  t) [inline]

Definition at line 197 of file token.h.

void Token::update_property_info ( ) [private]

Updates internal property cache like _isName or _isBoolean.

Called after any _str() modification.

Definition at line 62 of file token.cpp.

References _link, _str, _type, _varId, eArithmeticalOp, eAssignmentOp, eBitOp, eBoolean, eBracket, eChar, eComparisonOp, eExtendedOp, eFunction, eIncDecOp, eLogicalOp, eName, eNone, eNumber, eOther, eString, eType, eVariable, and update_property_isStandardType().

Referenced by concatStr(), and str().

Update internal property cache about isStandardType()

Definition at line 121 of file token.cpp.

References _isStandardType, _str, _type, and eType.

Referenced by update_property_info().

void Token::variable ( const Variable v) [inline]

Associate this token with given variable.

Parameters:
vVariable to be associated

Definition at line 484 of file token.h.

Referenced by CheckAutoVariables::autoVariables(), CheckOther::checkAssignBoolToPointer(), CheckOther::checkComparisonOfBoolExpressionWithInt(), CheckOther::checkComparisonOfBoolWithBool(), CheckOther::checkComparisonOfBoolWithInt(), CheckClass::checkConstFunc(), CheckOther::checkDuplicateExpression(), CheckUnusedVar::checkFunctionVariableUsage_iterateScopes(), CheckOther::checkIncompleteArrayFill(), CheckOther::checkNegativeBitwiseShift(), CheckOther::checkPipeParameterSize(), CheckBufferOverrun::checkScope(), CheckOther::checkSelfAssignment(), CheckOther::checkSignOfUnsignedVariable(), CheckOther::checkSizeofForArrayParameter(), CheckOther::checkSizeofForPointerSize(), CheckOther::checkSuspiciousStringCompare(), CheckIO::checkWrongPrintfScanfArguments(), CheckClass::copyconstructors(), CheckStl::if_find(), CheckOther::invalidPointerCast(), CheckAutoVariables::isAutoVar(), CheckAutoVariables::isAutoVarArray(), isContainerSizeSlow(), isLocal(), CheckAutoVariables::isNonReferenceArg(), CheckNullPointer::isPointerDeRef(), CheckAutoVariables::isPtrArg(), CheckAutoVariables::isRefPtrArg(), CheckUninitVar::isVariableUsage(), CheckBufferOverrun::negativeIndex(), CheckClass::noMemset(), CheckNullPointer::nullConstantDereference(), CheckNullPointer::nullPointerByCheckAndDeRef(), CheckNullPointer::nullPointerByDeRefAndChec(), UninitVar::parse(), Nullpointer::parse(), CheckStl::string_c_str(), and CheckOther::suspiciousSizeofCalculation().

const Variable* Token::variable ( ) const [inline]

Returns a pointer to the variable associated with this token.

Definition at line 495 of file token.h.

unsigned int Token::varId ( ) const [inline]

Definition at line 351 of file token.h.

Referenced by UninitVar::analyseFunctions(), CheckAutoVariables::autoVariables(), bailoutIfSwitch(), CheckStl::checkAutoPointer(), CheckBoost::checkBoostForeachModification(), CheckOther::checkComparisonOfBoolWithBool(), CheckOther::checkComparisonOfBoolWithInt(), CheckClass::checkConstFunc(), CheckOther::checkDuplicateExpression(), CheckIO::checkFileUsage(), CheckUnusedVar::checkFunctionVariableUsage_iterateScopes(), CheckBufferOverrun::checkGlobalAndLocalVariable(), CheckOther::checkIncorrectLogicOperator(), CheckOther::checkInnerScope(), CheckBufferOverrun::checkInsecureCmdLineArgs(), CheckOther::checkInvalidFree(), CheckUninitVar::checkLoopBody(), CheckMemoryLeakInClass::checkPublicFunctions(), CheckBufferOverrun::checkReadlinkBufferUsage(), CheckMemoryLeakInFunction::checkReallocUsage(), CheckOther::checkRedundantAssignment(), ExecutionPath::checkScope(), CheckBufferOverrun::checkScope(), EraseCheckLoop::checkScope(), CheckUninitVar::checkScopeForVariable(), CheckOther::checkSelfAssignment(), CheckOther::checkSignOfUnsignedVariable(), CheckOther::checkSizeofForArrayParameter(), CheckOther::checkSizeofForPointerSize(), Scope::checkVariable(), CheckOther::checkVariableScope(), conditionAlwaysTrueOrFalse(), CheckClass::copyconstructors(), Tokenizer::copyTokens(), UninitVar::dealloc_pointer(), Nullpointer::dereference(), doAssignment(), CheckStl::erase(), SymbolDatabase::findFunction(), for_init(), CheckMemoryLeak::functionArgAlloc(), CheckMemoryLeak::getAllocationType(), CheckMemoryLeakInFunction::getcode(), CheckStl::if_find(), UninitVar::init_memset_nonzero(), UninitVar::init_pointer(), UninitVar::init_strncpy(), CheckClass::initializeVarList(), Tokenizer::initVar(), TokenList::insertTokens(), CheckClass::isMemberVar(), CheckNullPointer::isPointerDeRef(), CheckUninitVar::isVariableUsage(), CheckLeakAutoVar::leakIfAllocated(), Match(), CheckAssignIf::multiCondition(), CheckBufferOverrun::negativeIndex(), CheckNullPointer::nullConstantDereference(), CheckNullPointer::nullPointerByCheckAndDeRef(), CheckNullPointer::nullPointerByDeRefAndChec(), UninitVar::parse(), EraseCheckLoop::parse(), Nullpointer::parse(), ExecutionPathBufferOverrun::parse(), UninitVar::parseCondition(), CheckNullPointer::parseFunctionCall(), UninitVar::parserhs(), UninitVar::pointer_assignment(), Tokenizer::removeRedundantFor(), Tokenizer::setVarId(), setVarIdStructMembers(), Tokenizer::simplifyAssignmentBlock(), Tokenizer::simplifyComparisonOrder(), Tokenizer::simplifyFuncInWhile(), Tokenizer::simplifyGoto(), Tokenizer::simplifyIfAssign(), Tokenizer::simplifyKnownVariables(), Tokenizer::simplifyKnownVariablesGetData(), Tokenizer::simplifyKnownVariablesSimplify(), Tokenizer::simplifyNestedStrcat(), Tokenizer::simplifyStructDecl(), Tokenizer::simplifyStructInit(), Tokenizer::simplifyVarDecl(), CheckStl::size(), SymbolDatabase::SymbolDatabase(), UninitVar::use(), and CheckMemoryLeakInClass::variable().

void Token::varId ( unsigned int  id) [inline]

Definition at line 354 of file token.h.


Member Data Documentation

union { ... } [private]

Definition at line 625 of file token.h.

Referenced by astFunctionCall(), astHandleParentheses(), and astOperand1().

Definition at line 626 of file token.h.

Referenced by astHandleParentheses(), and astOperand2().

Definition at line 627 of file token.h.

Referenced by astFunctionCall(), astHandleParentheses(), astOperand1(), astOperand2(), and astTop().

unsigned int Token::_fileIndex [private]

Definition at line 599 of file token.h.

Referenced by deleteThis(), insertToken(), and stringifyList().

Definition at line 593 of file token.h.

Referenced by deleteThis().

bool Token::_isExpandedMacro [private]

Definition at line 615 of file token.h.

Referenced by deleteThis().

bool Token::_isLong [private]

Definition at line 612 of file token.h.

Referenced by deleteThis().

bool Token::_isPointerCompare [private]

Definition at line 611 of file token.h.

Referenced by deleteThis().

bool Token::_isSigned [private]

Definition at line 610 of file token.h.

Referenced by deleteThis().

bool Token::_isStandardType [private]

Definition at line 614 of file token.h.

Referenced by deleteThis(), and update_property_isStandardType().

bool Token::_isUnsigned [private]

Definition at line 609 of file token.h.

Referenced by deleteThis().

bool Token::_isUnused [private]

Definition at line 613 of file token.h.

Referenced by deleteThis().

unsigned int Token::_linenr [private]

Definition at line 600 of file token.h.

Referenced by deleteThis(), insertToken(), and stringifyList().

Token* Token::_link [private]

Definition at line 588 of file token.h.

Referenced by deleteThis(), and update_property_info().

Token* Token::_next [private]

Definition at line 586 of file token.h.

Referenced by astFunctionCall(), astHandleParentheses(), deleteNext(), and deleteThis().

Token* Token::_previous [private]

Definition at line 587 of file token.h.

Referenced by astHandleParentheses(), and deleteThis().

unsigned int Token::_progressValue [private]

A value from 0-100 that provides a rough idea about where in the token list this token is located.

Definition at line 606 of file token.h.

Referenced by insertToken(), move(), and replace().

const Scope* Token::_scope [private]

Definition at line 591 of file token.h.

Referenced by deleteThis().

std::string Token::_str [private]
Type Token::_type [private]

Definition at line 594 of file token.h.

Referenced by deleteThis().

unsigned int Token::_varId [private]

Definition at line 598 of file token.h.

Referenced by deleteThis(), str(), stringify(), and update_property_info().

Token** Token::tokensBack [private]

Definition at line 46 of file token.h.

Referenced by deleteNext(), insertToken(), and replace().


The documentation for this class was generated from the following files: