Cppcheck
|
Base class for Execution Paths checking An execution path is a linear list of statements. More...
#include <executionpath.h>
Public Member Functions | |
ExecutionPath (Check *c, unsigned int id) | |
virtual | ~ExecutionPath () |
virtual ExecutionPath * | copy ()=0 |
Implement this in each derived class. | |
void | print () const |
print checkdata | |
virtual const Token * | parse (const Token &tok, std::list< ExecutionPath * > &checks) const =0 |
Parse tokens at given location. | |
virtual bool | parseCondition (const Token &tok, std::list< ExecutionPath * > &checks) |
Parse condition. | |
virtual void | parseLoopBody (const Token *tok, std::list< ExecutionPath * > &checks) const |
Parse loop body. | |
virtual void | end (const std::list< ExecutionPath * > &, const Token *) const |
going out of scope - all execution paths end | |
bool | operator== (const ExecutionPath &e) const |
Static Public Member Functions | |
static void | bailOut (std::list< ExecutionPath * > &checks) |
bail out all execution paths | |
static void | bailOutVar (std::list< ExecutionPath * > &checks, const unsigned int varid) |
bail out execution paths with given variable id | |
static void | checkScope (const Token *tok, std::list< ExecutionPath * > &checks) |
Public Attributes | |
unsigned int | numberOfIf |
number of if blocks | |
const unsigned int | varId |
Protected Member Functions | |
virtual bool | is_equal (const ExecutionPath *) const =0 |
Are two execution paths equal? |
Protected Attributes | |
Check *const | owner |
Private Member Functions | |
ExecutionPath () | |
No implementation. | |
ExecutionPath & | operator= (const ExecutionPath &) |
Base class for Execution Paths checking An execution path is a linear list of statements.
There are no "if"/.. to worry about.
Definition at line 35 of file executionpath.h.
|
private |
No implementation.
|
inline |
Definition at line 48 of file executionpath.h.
|
inlinevirtual |
Definition at line 51 of file executionpath.h.
|
inlinestatic |
bail out all execution paths
checks | the execution paths to bail out on |
Definition at line 69 of file executionpath.h.
Referenced by checkScope(), UninitVar::parse(), and EraseCheckLoop::parse().
|
inlinestatic |
bail out execution paths with given variable id
checks | the execution paths to bail out on |
varid | the specific variable id |
Definition at line 81 of file executionpath.h.
Referenced by UninitVar::alloc_pointer(), checkScope(), UninitVar::parse(), EraseCheckLoop::parse(), parseCondition(), UninitVar::parseLoopBody(), UninitVar::parserhs(), and UninitVar::pointer_assignment().
|
static |
Definition at line 132 of file executionpath.cpp.
References bailOut(), bailOutVar(), copy(), end(), Token::findsimplematch(), Token::link(), Token::linkAt(), Token::Match(), Token::next(), numberOfIf, parseIfSwitchBody(), Token::previous(), Token::simpleMatch(), Token::str(), Token::tokAt(), and Token::varId().
Referenced by checkExecutionPaths(), and parseIfSwitchBody().
|
pure virtual |
Implement this in each derived class.
This function must create a copy of the current instance
Referenced by checkExecutionPaths(), and checkScope().
|
inlinevirtual |
going out of scope - all execution paths end
Definition at line 123 of file executionpath.h.
Referenced by checkExecutionPaths(), and checkScope().
|
protectedpure virtual |
Are two execution paths equal?
|
private |
|
inline |
Definition at line 126 of file executionpath.h.
References varId.
|
pure virtual |
Parse tokens at given location.
tok | token to parse |
checks | The execution paths. All execution paths in the list are executed in the current scope. |
|
virtual |
Parse condition.
tok | first token in condition. |
checks | The execution paths. All execution paths in the list are executed in the current scope |
Definition at line 31 of file executionpath.cpp.
References bailOutVar(), Token::Match(), and Token::next().
|
inlinevirtual |
Parse loop body.
tok | the first token in the loop body (the token after the {) |
checks | The execution paths |
Definition at line 117 of file executionpath.h.
void ExecutionPath::print | ( | ) | const |
unsigned int ExecutionPath::numberOfIf |
number of if blocks
Definition at line 61 of file executionpath.h.
Referenced by checkScope(), and print().
|
protected |
Definition at line 42 of file executionpath.h.
Referenced by UninitVar::dealloc_pointer(), EraseCheckLoop::end(), UninitVar::parse(), and UninitVar::use().
const unsigned int ExecutionPath::varId |
Definition at line 63 of file executionpath.h.
Referenced by UninitVar::alloc_pointer(), UninitVar::dealloc_pointer(), UninitVar::init_memset_nonzero(), UninitVar::init_pointer(), UninitVar::init_strncpy(), operator==(), UninitVar::parse(), EraseCheckLoop::parse(), UninitVar::pointer_assignment(), print(), and UninitVar::use().