Cppcheck
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
ExecutionPath Class Reference

Base class for Execution Paths checking An execution path is a linear list of statements. More...

#include <executionpath.h>

Inheritance diagram for ExecutionPath:
EraseCheckLoop UninitVar

Public Member Functions

 ExecutionPath (Check *c, unsigned int id)
virtual ~ExecutionPath ()
virtual ExecutionPathcopy ()=0
 Implement this in each derived class.
void print () const
 print checkdata
virtual const Tokenparse (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.
ExecutionPathoperator= (const ExecutionPath &)

Detailed Description

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.

Constructor & Destructor Documentation

ExecutionPath::ExecutionPath ( )
private

No implementation.

ExecutionPath::ExecutionPath ( Check c,
unsigned int  id 
)
inline

Definition at line 48 of file executionpath.h.

virtual ExecutionPath::~ExecutionPath ( )
inlinevirtual

Definition at line 51 of file executionpath.h.

Member Function Documentation

static void ExecutionPath::bailOut ( std::list< ExecutionPath * > &  checks)
inlinestatic

bail out all execution paths

Parameters
checksthe execution paths to bail out on

Definition at line 69 of file executionpath.h.

Referenced by checkScope(), UninitVar::parse(), and EraseCheckLoop::parse().

static void ExecutionPath::bailOutVar ( std::list< ExecutionPath * > &  checks,
const unsigned int  varid 
)
inlinestatic

bail out execution paths with given variable id

Parameters
checksthe execution paths to bail out on
varidthe 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().

void ExecutionPath::checkScope ( const Token tok,
std::list< ExecutionPath * > &  checks 
)
static
virtual ExecutionPath* ExecutionPath::copy ( )
pure virtual

Implement this in each derived class.

This function must create a copy of the current instance

Referenced by checkExecutionPaths(), and checkScope().

virtual void ExecutionPath::end ( const std::list< ExecutionPath * > &  ,
const Token  
) const
inlinevirtual

going out of scope - all execution paths end

Definition at line 123 of file executionpath.h.

Referenced by checkExecutionPaths(), and checkScope().

virtual bool ExecutionPath::is_equal ( const ExecutionPath ) const
protectedpure virtual

Are two execution paths equal?

ExecutionPath& ExecutionPath::operator= ( const ExecutionPath )
private
bool ExecutionPath::operator== ( const ExecutionPath e) const
inline

Definition at line 126 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.

Parameters
toktoken to parse
checksThe execution paths. All execution paths in the list are executed in the current scope.
Returns
the token before the "next" token.
bool ExecutionPath::parseCondition ( const Token tok,
std::list< ExecutionPath * > &  checks 
)
virtual

Parse condition.

Parameters
tokfirst token in condition.
checksThe execution paths. All execution paths in the list are executed in the current scope
Returns
true => bail out all checking

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
inlinevirtual

Parse loop body.

Parameters
tokthe first token in the loop body (the token after the {)
checksThe execution paths

Definition at line 117 of file executionpath.h.

void ExecutionPath::print ( ) const

print checkdata

Definition at line 62 of file executionpath.cpp.

References numberOfIf, and varId.

Member Data Documentation

unsigned int ExecutionPath::numberOfIf

number of if blocks

Definition at line 61 of file executionpath.h.

Referenced by checkScope(), and print().

Check* const ExecutionPath::owner
protected
const unsigned int ExecutionPath::varId

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