Internals: Minor internal code coverage cleanups

This commit is contained in:
Wilson Snyder 2023-09-10 18:53:51 -04:00
parent b5b278d072
commit d72f1b89fc
7 changed files with 12 additions and 30 deletions

View File

@ -247,7 +247,7 @@ private:
} else if (AstNodeFTask* taskp = VN_CAST(m_procp, NodeFTask)) {
stmtsp = taskp->stmtsp();
} else {
v3fatal("m_procp is not a begin block or a procedure");
m_procp->v3fatalSrc("m_procp is not a begin block or a procedure");
}
return stmtsp;
}

View File

@ -92,26 +92,6 @@ void V3GraphVertex::rerouteEdges(V3Graph* graphp) {
bool V3GraphVertex::inSize1() const { return !inEmpty() && !inBeginp()->inNextp(); }
bool V3GraphVertex::outSize1() const { return !outEmpty() && !outBeginp()->outNextp(); }
uint32_t V3GraphVertex::inHash() const {
// We want the same hash ignoring the order of edges.
// So we need an associative operator, like XOR.
// However with XOR multiple edges to the same source will cancel out,
// so we use ADD. (Generally call this only after removing duplicates though)
uint32_t hash = 0;
for (V3GraphEdge* edgep = this->inBeginp(); edgep; edgep = edgep->inNextp()) {
hash += cvtToHash(edgep->fromp());
}
return hash;
}
uint32_t V3GraphVertex::outHash() const {
uint32_t hash = 0;
for (V3GraphEdge* edgep = this->outBeginp(); edgep; edgep = edgep->outNextp()) {
hash += cvtToHash(edgep->top());
}
return hash;
}
V3GraphEdge* V3GraphVertex::findConnectingEdgep(GraphWay way, const V3GraphVertex* waywardp) {
// O(edges) linear search. Searches search both nodes' edge lists in
// parallel. The lists probably aren't _both_ huge, so this is

View File

@ -276,11 +276,9 @@ public:
V3GraphEdge* inBeginp() const { return m_ins.begin(); }
bool inEmpty() const { return inBeginp() == nullptr; }
bool inSize1() const;
uint32_t inHash() const;
V3GraphEdge* outBeginp() const { return m_outs.begin(); }
bool outEmpty() const { return outBeginp() == nullptr; }
bool outSize1() const;
uint32_t outHash() const;
V3GraphEdge* beginp(GraphWay way) const { return way.forward() ? outBeginp() : inBeginp(); }
// METHODS
/// Error reporting

View File

@ -501,11 +501,11 @@ size_t V3PreLex::inputToLex(char* buf, size_t max_size) {
// become a stale invalid pointer.
//
VPreStream* streamp = curStreamp();
if (debug() >= 10) {
if (debug() >= 10) { // LCOV_EXCL_START
cout << "- pp:inputToLex ITL s=" << max_size << " bs=" << streamp->m_buffers.size()
<< endl;
dumpStack();
}
} // LCOV_EXCL_STOP
// For testing, use really small chunks
// if (max_size > 13) max_size=13;
again:
@ -696,16 +696,16 @@ void V3PreLex::warnBackslashSpace() {
BSSPACE, "Backslash followed by whitespace, perhaps the whitespace is accidental?");
}
void V3PreLex::dumpSummary() {
void V3PreLex::dumpSummary() { // LCOV_EXCL_START
cout << "- pp::dumpSummary curBuf=" << cvtToHex(currentBuffer());
#ifdef FLEX_DEBUG // Else peeking at internals may cause portability issues
ssize_t left = (yy_n_chars - (yy_c_buf_p - currentBuffer()->yy_ch_buf));
cout << " left=" << std::dec << left;
#endif
cout << endl;
}
} // LCOV_EXCL_STOP
void V3PreLex::dumpStack() {
void V3PreLex::dumpStack() { // LCOV_EXCL_START
// For debug use
dumpSummary();
std::stack<VPreStream*> tmpstack = LEXP->m_streampStack;
@ -717,7 +717,7 @@ void V3PreLex::dumpStack() {
<< (streamp->m_eof ? " [EOF]" : "") << (streamp->m_file ? " [FILE]" : "") << endl;
tmpstack.pop();
}
}
} // LCOV_EXCL_STOP
string V3PreLex::cleanDbgStrg(const string& in) {
string result = in;

View File

@ -101,7 +101,6 @@ foreach my $s (
'Unsupported: no_inline for tasks',
'Unsupported: static cast to ',
'Unsupported: super',
'\'foreach\' loop variable expects simple variable name',
) { $Suppressed{$s} = 1; }
if (!-r "$root/.git") {

View File

@ -1,4 +1,7 @@
%Error: t/t_foreach_bad.v:14:7: Syntax error; foreach missing bracketed loop variable (IEEE 1800-2017 12.7.3)
14 | foreach (array);
| ^~~~~~~
%Error: t/t_foreach_bad.v:18:23: 'foreach' loop variable expects simple variable name
18 | foreach (array[a.b]);
| ^
%Error: Exiting due to

View File

@ -15,6 +15,8 @@ module t (/*AUTOARG*/);
foreach (array.array[a]); // not supported
foreach (array[a.b]); // no index
$write("*-* All Finished *-*\n");
$finish;
end