|
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 | |
| void | operator= (const ExecutionPath &) |
| No implementation. | |
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 33 of file executionpath.h.
| ExecutionPath::ExecutionPath | ( | Check * | c, |
| unsigned int | id | ||
| ) | [inline] |
Definition at line 45 of file executionpath.h.
| virtual ExecutionPath::~ExecutionPath | ( | ) | [inline, virtual] |
Definition at line 48 of file executionpath.h.
| static void ExecutionPath::bailOut | ( | std::list< ExecutionPath * > & | checks | ) | [inline, static] |
bail out all execution paths
| checks | the execution paths to bail out on |
Definition at line 66 of file executionpath.h.
Referenced by checkScope(), UninitVar::parse(), and EraseCheckLoop::parse().
| static void ExecutionPath::bailOutVar | ( | std::list< ExecutionPath * > & | checks, |
| const unsigned int | varid | ||
| ) | [inline, static] |
bail out execution paths with given variable id
| checks | the execution paths to bail out on |
| varid | the specific variable id |
Definition at line 78 of file executionpath.h.
Referenced by UninitVar::alloc_pointer(), checkScope(), UninitVar::parse(), EraseCheckLoop::parse(), Nullpointer::parse(), parseCondition(), UninitVar::parseLoopBody(), UninitVar::parserhs(), and UninitVar::pointer_assignment().
| void ExecutionPath::checkScope | ( | const Token * | tok, |
| std::list< ExecutionPath * > & | checks | ||
| ) | [static] |
Definition at line 132 of file executionpath.cpp.
References bailOut(), bailOutVar(), copy(), 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().
| virtual ExecutionPath* ExecutionPath::copy | ( | ) | [pure virtual] |
Implement this in each derived class.
This function must create a copy of the current instance
Implemented in ExecutionPathBufferOverrun, Nullpointer, EraseCheckLoop, and UninitVar.
Referenced by checkExecutionPaths(), and checkScope().
| virtual void ExecutionPath::end | ( | const std::list< ExecutionPath * > & | , |
| const Token * | |||
| ) | const [inline, virtual] |
going out of scope - all execution paths end
Reimplemented in EraseCheckLoop.
Definition at line 120 of file executionpath.h.
Referenced by checkExecutionPaths().
| virtual bool ExecutionPath::is_equal | ( | const ExecutionPath * | ) | const [protected, pure virtual] |
Are two execution paths equal?
Implemented in ExecutionPathBufferOverrun, Nullpointer, EraseCheckLoop, and UninitVar.
| void ExecutionPath::operator= | ( | const ExecutionPath & | ) | [private] |
No implementation.
| bool ExecutionPath::operator== | ( | const ExecutionPath & | e | ) | const [inline] |
Definition at line 123 of file executionpath.h.
References varId.
| virtual const Token* ExecutionPath::parse | ( | const Token & | tok, |
| std::list< ExecutionPath * > & | checks | ||
| ) | const [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. |
Implemented in ExecutionPathBufferOverrun, Nullpointer, EraseCheckLoop, and UninitVar.
| bool ExecutionPath::parseCondition | ( | const Token & | tok, |
| std::list< ExecutionPath * > & | checks | ||
| ) | [virtual] |
Parse condition.
| tok | first token in condition. |
| checks | The execution paths. All execution paths in the list are executed in the current scope |
Reimplemented in Nullpointer, UninitVar, and EraseCheckLoop.
Definition at line 31 of file executionpath.cpp.
References bailOutVar(), Token::Match(), and Token::next().
| virtual void ExecutionPath::parseLoopBody | ( | const Token * | tok, |
| std::list< ExecutionPath * > & | checks | ||
| ) | const [inline, virtual] |
Parse loop body.
| tok | the first token in the loop body (the token after the {) |
| checks | The execution paths |
Reimplemented in Nullpointer, and UninitVar.
Definition at line 114 of file executionpath.h.
| void ExecutionPath::print | ( | ) | const |
| unsigned int ExecutionPath::numberOfIf |
number of if blocks
Definition at line 58 of file executionpath.h.
Referenced by checkScope(), and print().
Check* const ExecutionPath::owner [protected] |
Definition at line 39 of file executionpath.h.
Referenced by ExecutionPathBufferOverrun::array_index(), UninitVar::dealloc_pointer(), Nullpointer::dereference(), EraseCheckLoop::end(), UninitVar::parse(), Nullpointer::parse(), Nullpointer::parseCondition(), and UninitVar::use().
| const unsigned int ExecutionPath::varId |
Definition at line 60 of file executionpath.h.
Referenced by UninitVar::alloc_pointer(), ExecutionPathBufferOverrun::array_index(), ExecutionPathBufferOverrun::assign_value(), UninitVar::dealloc_pointer(), Nullpointer::dereference(), UninitVar::init_memset_nonzero(), UninitVar::init_pointer(), UninitVar::init_strncpy(), operator==(), UninitVar::parse(), EraseCheckLoop::parse(), UninitVar::pointer_assignment(), print(), Nullpointer::setnull(), and UninitVar::use().
1.7.6.1