ExecutionPath: Refactoring. Removed the bailOut variable

This commit is contained in:
Daniel Marjamäki 2009-12-29 09:30:02 +01:00
parent cfdf2b8cfe
commit 4cbae159b2
3 changed files with 45 additions and 77 deletions

View File

@ -1329,15 +1329,12 @@ private:
{
std::list<ExecutionPath *>::const_iterator it;
for (it = checks.begin(); it != checks.end(); ++it)
{
if (!(*it)->bailOut())
{
CheckUninitVar *c = dynamic_cast<CheckUninitVar *>(*it);
if (c && c->varId == varid)
c->alloc = true;
}
}
}
// *p = ..
static void init_pointer(bool &foundError, std::list<ExecutionPath *> &checks, const Token *tok)
@ -1348,8 +1345,6 @@ private:
std::list<ExecutionPath *>::iterator it = checks.begin();
while (it != checks.end())
{
if (!(*it)->bailOut())
{
CheckUninitVar *c = dynamic_cast<CheckUninitVar *>(*it);
if (c && c->varId == varid)
@ -1365,7 +1360,6 @@ private:
use_pointer(foundError, checks, tok);
}
}
}
++it;
}
@ -1380,8 +1374,6 @@ private:
std::list<ExecutionPath *>::const_iterator it;
for (it = checks.begin(); it != checks.end(); ++it)
{
if (!(*it)->bailOut())
{
CheckUninitVar *c = dynamic_cast<CheckUninitVar *>(*it);
if (c && c->varId == varid)
@ -1400,7 +1392,6 @@ private:
}
}
}
}
/**
* use - called from the use* functions below.
@ -1417,8 +1408,6 @@ private:
std::list<ExecutionPath *>::const_iterator it;
for (it = checks.begin(); it != checks.end(); ++it)
{
if (!(*it)->bailOut())
{
CheckUninitVar *c = dynamic_cast<CheckUninitVar *>(*it);
if (c && c->varId == varid)
@ -1448,7 +1437,6 @@ private:
}
}
}
}
/**
* Reading variable. Use this function in situations when it is

View File

@ -175,19 +175,6 @@ static const Token *checkExecutionPaths_(const Token *tok, std::list<ExecutionPa
{
bool foundError = false;
tok = check->parse(*tok, foundError, checks);
std::list<ExecutionPath *>::iterator it;
for (it = checks.begin(); it != checks.end();)
{
if ((*it)->bailOut())
{
delete *it;
it = checks.erase(it);
}
else
{
++it;
}
}
if (checks.empty())
return 0;
else if (foundError)

View File

@ -31,8 +31,6 @@ class Check;
class ExecutionPath
{
private:
bool bailout_;
/** No implementation */
void operator=(const ExecutionPath &);
@ -41,7 +39,7 @@ protected:
Check * const owner;
public:
ExecutionPath(Check *c, unsigned int id) : bailout_(false), varId(id), owner(c), ifinfo(0)
ExecutionPath(Check *c, unsigned int id) : varId(id), owner(c), ifinfo(0)
{ }
virtual ~ExecutionPath()
@ -53,11 +51,6 @@ public:
/** Some kind of if-information */
unsigned int ifinfo;
bool bailOut() const
{
return bailout_;
}
/**
* bail out all execution paths
* @param checks the execution paths to bail out on