Skip to content

Commit

Permalink
Merge pull request #23 from jensgerlach/master
Browse files Browse the repository at this point in the history
update previous pull-request by removing unwanted else-branch
  • Loading branch information
chenyang78 committed Nov 1, 2015
2 parents 73be7ed + 5f53009 commit 8955465
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/Effect.cpp
Expand Up @@ -298,27 +298,24 @@ Effect::add_external_effect(const Effect &e, std::vector<const Block*> call_chai
}

/*
* TODO: tried doing this with `find', but I couldn't get all the `const's
* right. Gave up; wrote it by hand!
*
*
*/
bool
Effect::is_read(const Variable *v) const
{
vector<Variable *>::size_type len = read_vars.size();
vector<Variable *>::size_type i;

for (i = 0; i < len; ++i) {
if (read_vars[i] == v) {
return true;
}
if (std::find(read_vars.begin(), read_vars.end(), v) != read_vars.end()) {
return true;
}

// if we read a struct, presumingly all the fields are read too
// however we can not say the same thing for unions: reading a particular
// unions field can cause unspecified behaviors, while reading the whole
// union won't
if (v->field_var_of && v->field_var_of->type->eType == eStruct) {
return is_read(v->field_var_of);
}

return false;
}

Expand Down

0 comments on commit 8955465

Please sign in to comment.