Fix missing coverage line on else-if, bug727.
This commit is contained in:
parent
b655c17c09
commit
40bceea68a
2
Changes
2
Changes
|
|
@ -17,6 +17,8 @@ indicates the contributor was also the author of the fix; Thanks!
|
||||||
|
|
||||||
**** Fix tracing of package variables and real arrays.
|
**** Fix tracing of package variables and real arrays.
|
||||||
|
|
||||||
|
**** Fix missing coverage line on else-if, bug727. [Sharad Bagri]
|
||||||
|
|
||||||
**** Fix Mac OS-X test issues. [Holger Waechtler]
|
**** Fix Mac OS-X test issues. [Holger Waechtler]
|
||||||
|
|
||||||
**** Fix C++-2011 warnings.
|
**** Fix C++-2011 warnings.
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,11 @@ private:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// NODE STATE
|
||||||
|
// Entire netlist:
|
||||||
|
// AstIf::user1() -> bool. True indicates ifelse processed
|
||||||
|
AstUser1InUse m_inuser1;
|
||||||
|
|
||||||
// STATE
|
// STATE
|
||||||
bool m_checkBlock; // Should this block get covered?
|
bool m_checkBlock; // Should this block get covered?
|
||||||
AstNodeModule* m_modp; // Current module to add statement to
|
AstNodeModule* m_modp; // Current module to add statement to
|
||||||
|
|
@ -277,12 +282,18 @@ private:
|
||||||
virtual void visit(AstIf* nodep, AstNUser*) { // Note not AstNodeIf; other types don't get covered
|
virtual void visit(AstIf* nodep, AstNUser*) { // Note not AstNodeIf; other types don't get covered
|
||||||
UINFO(4," IF: "<<nodep<<endl);
|
UINFO(4," IF: "<<nodep<<endl);
|
||||||
if (m_checkBlock) {
|
if (m_checkBlock) {
|
||||||
|
// An else-if. When we iterate the if, use "elsif" marking
|
||||||
|
bool elsif = (nodep->elsesp()->castIf()
|
||||||
|
&& !nodep->elsesp()->castIf()->nextp());
|
||||||
|
if (elsif) nodep->elsesp()->castIf()->user1(true);
|
||||||
|
//
|
||||||
nodep->ifsp()->iterateAndNext(*this);
|
nodep->ifsp()->iterateAndNext(*this);
|
||||||
if (m_checkBlock && !m_inModOff
|
if (m_checkBlock && !m_inModOff
|
||||||
&& nodep->fileline()->coverageOn() && v3Global.opt.coverageLine()) { // if a "if" branch didn't disable it
|
&& nodep->fileline()->coverageOn() && v3Global.opt.coverageLine()) { // if a "if" branch didn't disable it
|
||||||
if (!nodep->backp()->castIf()
|
|
||||||
|| nodep->backp()->castIf()->elsesp()!=nodep) { // Ignore if else; did earlier
|
|
||||||
UINFO(4," COVER: "<<nodep<<endl);
|
UINFO(4," COVER: "<<nodep<<endl);
|
||||||
|
if (nodep->user1()) {
|
||||||
|
nodep->addIfsp(newCoverInc(nodep->fileline(), "", "v_line", "elsif"));
|
||||||
|
} else {
|
||||||
nodep->addIfsp(newCoverInc(nodep->fileline(), "", "v_line", "if"));
|
nodep->addIfsp(newCoverInc(nodep->fileline(), "", "v_line", "if"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -293,9 +304,7 @@ private:
|
||||||
if (m_checkBlock && !m_inModOff
|
if (m_checkBlock && !m_inModOff
|
||||||
&& nodep->fileline()->coverageOn() && v3Global.opt.coverageLine()) { // if a "else" branch didn't disable it
|
&& nodep->fileline()->coverageOn() && v3Global.opt.coverageLine()) { // if a "else" branch didn't disable it
|
||||||
UINFO(4," COVER: "<<nodep<<endl);
|
UINFO(4," COVER: "<<nodep<<endl);
|
||||||
if (nodep->elsesp()->castIf()) {
|
if (!elsif) { // elsif done inside if()
|
||||||
nodep->addElsesp(newCoverInc(nodep->elsesp()->fileline(), "", "v_line", "elsif"));
|
|
||||||
} else {
|
|
||||||
nodep->addElsesp(newCoverInc(nodep->elsesp()->fileline(), "", "v_line", "else"));
|
nodep->addElsesp(newCoverInc(nodep->elsesp()->fileline(), "", "v_line", "else"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue