Internals: cpplint cleanups. No functional change.

This commit is contained in:
Wilson Snyder 2022-01-08 12:01:39 -05:00
parent 441ecfedc9
commit 15b32dc140
32 changed files with 67 additions and 37 deletions

View File

@ -180,7 +180,7 @@ public:
} }
// Internal class access // Internal class access
inline VerilatedFst* spTrace() { return &m_sptrace; }; inline VerilatedFst* spTrace() { return &m_sptrace; }
}; };
#endif // guard #endif // guard

View File

@ -849,8 +849,8 @@ template <class T_Value, std::size_t T_Depth> struct VlUnpacked final {
WData* data() { return &m_storage[0]; } WData* data() { return &m_storage[0]; }
const WData* data() const { return &m_storage[0]; } const WData* data() const { return &m_storage[0]; }
T_Value& operator[](size_t index) { return m_storage[index]; }; T_Value& operator[](size_t index) { return m_storage[index]; }
const T_Value& operator[](size_t index) const { return m_storage[index]; }; const T_Value& operator[](size_t index) const { return m_storage[index]; }
// Dumping. Verilog: str = $sformatf("%p", assoc) // Dumping. Verilog: str = $sformatf("%p", assoc)
std::string to_string() const { std::string to_string() const {

View File

@ -1697,7 +1697,7 @@ void vl_get_value(const VerilatedVar* varp, void* varDatap, p_vpi_value valuep,
// Maximum required size is for binary string, one byte per bit plus null termination // Maximum required size is for binary string, one byte per bit plus null termination
static VL_THREAD_LOCAL char t_outStr[VL_VALUE_STRING_MAX_WORDS * VL_EDATASIZE + 1]; static VL_THREAD_LOCAL char t_outStr[VL_VALUE_STRING_MAX_WORDS * VL_EDATASIZE + 1];
// cppcheck-suppress variableScope // cppcheck-suppress variableScope
const static VL_THREAD_LOCAL int t_outStrSz = sizeof(t_outStr) - 1; static const VL_THREAD_LOCAL int t_outStrSz = sizeof(t_outStr) - 1;
// We used to presume vpiValue.format = vpiIntVal or if single bit vpiScalarVal // We used to presume vpiValue.format = vpiIntVal or if single bit vpiScalarVal
// This may cause backward compatibility issues with older code. // This may cause backward compatibility issues with older code.
if (valuep->format == vpiVectorVal) { if (valuep->format == vpiVectorVal) {

View File

@ -163,9 +163,9 @@ public:
LatchDetectGraphVertex* outVertexp; LatchDetectGraphVertex* outVertexp;
if (!nodep->varp()->user1p()) { // Not seen this output before if (!nodep->varp()->user1p()) { // Not seen this output before
outVertexp = addOutputVertex(nodep); outVertexp = addOutputVertex(nodep);
} else } else {
outVertexp = castVertexp(nodep->varp()->user1p()); outVertexp = castVertexp(nodep->varp()->user1p());
}
new V3GraphEdge(this, m_curVertexp, outVertexp, 1); new V3GraphEdge(this, m_curVertexp, outVertexp, 1);
} }
// Run latchCheckInternal on each variable assigned by the always block to see if all control // Run latchCheckInternal on each variable assigned by the always block to see if all control

View File

@ -27,8 +27,12 @@
#include "V3Broken.h" #include "V3Broken.h"
#include <cmath> #include <cmath>
#include <map>
#include <set>
#include <type_traits> #include <type_traits>
#include <unordered_set> #include <unordered_set>
#include <utility>
#include <vector>
#include "V3Ast__gen_classes.h" // From ./astgen #include "V3Ast__gen_classes.h" // From ./astgen
// Things like: // Things like:

View File

@ -225,7 +225,7 @@ private:
while (nodep) { while (nodep) {
processAndIterate(nodep); processAndIterate(nodep);
nodep = nodep->nextp(); nodep = nodep->nextp();
}; }
} }
void pushLocalScope() { void pushLocalScope() {
if (m_cfuncp) m_localsStack.emplace_back(); if (m_cfuncp) m_localsStack.emplace_back();

View File

@ -118,7 +118,7 @@ public:
rootFuncp->addStmtsp(callp); rootFuncp->addStmtsp(callp);
} }
} }
}; }
private: private:
VL_UNCOPYABLE(V3CCtorsBuilder); VL_UNCOPYABLE(V3CCtorsBuilder);

View File

@ -951,8 +951,9 @@ private:
} else if (VN_IS(nodep->rhsp(), And)) { } else if (VN_IS(nodep->rhsp(), And)) {
andp = VN_AS(nodep->rhsp(), And); andp = VN_AS(nodep->rhsp(), And);
ap = nodep->lhsp(); ap = nodep->lhsp();
} else } else {
return false; return false;
}
const AstNodeUniop* notp; const AstNodeUniop* notp;
AstNode* cp; AstNode* cp;
if (VN_IS(andp->lhsp(), Not)) { if (VN_IS(andp->lhsp(), Not)) {

View File

@ -79,8 +79,9 @@ void EmitCFunc::emitOpName(AstNode* nodep, const string& format, AstNode* lhsp,
if (needComma) { if (needComma) {
if (pos[1] == ' ') { if (pos[1] == ' ') {
nextComma = ", "; nextComma = ", ";
} else } else {
nextComma = ","; nextComma = ",";
}
needComma = false; needComma = false;
} }
if (pos[1] == ' ') ++pos; // Must do even if no nextComma if (pos[1] == ' ') ++pos; // Must do even if no nextComma

View File

@ -37,7 +37,8 @@
// FileLineSingleton class functions // FileLineSingleton class functions
string FileLineSingleton::filenameLetters(int fileno) { string FileLineSingleton::filenameLetters(int fileno) {
const int size = 1 + (64 / 4); // Each letter retires more than 4 bits of a > 64 bit number constexpr int size
= 1 + (64 / 4); // Each letter retires more than 4 bits of a > 64 bit number
char out[size]; char out[size];
char* op = out + size - 1; char* op = out + size - 1;
*--op = '\0'; // We build backwards *--op = '\0'; // We build backwards

View File

@ -23,6 +23,8 @@
#include "V3Graph.h" #include "V3Graph.h"
#include <functional>
#include <map>
#include <set> #include <set>
#include <unordered_map> #include <unordered_map>

View File

@ -29,6 +29,7 @@
#include <set> #include <set>
#include <string> #include <string>
#include <utility> #include <utility>
#include <unordered_map>
#include <unordered_set> #include <unordered_set>
#include <vector> #include <vector>

View File

@ -512,9 +512,10 @@ public:
if (it2 != m_scopeAliasMap[samn].end()) { if (it2 != m_scopeAliasMap[samn].end()) {
srcp = it2->second; srcp = it2->second;
continue; continue;
} else } else {
break; break;
} }
}
UINFO(9, " iiasa: Insert alias se" << lhsp << " (" << lhsp->nodep()->typeName() UINFO(9, " iiasa: Insert alias se" << lhsp << " (" << lhsp->nodep()->typeName()
<< ") <- se" << srcp << " " << srcp->nodep() << ") <- se" << srcp << " " << srcp->nodep()
<< endl); << endl);
@ -623,9 +624,10 @@ public:
} }
break; break;
} }
} else } else {
break; break;
} }
}
if (!lookupSymp) return nullptr; // Not found if (!lookupSymp) return nullptr; // Not found
} }
} else { // Searching for middle submodule, must be a cell name } else { // Searching for middle submodule, must be a cell name

View File

@ -23,6 +23,8 @@
#include "V3Error.h" #include "V3Error.h"
#include "V3Ast.h" #include "V3Ast.h"
#include <vector>
//============================================================================ //============================================================================
class V3LinkLevel final { class V3LinkLevel final {

View File

@ -23,6 +23,7 @@
#include "V3Error.h" #include "V3Error.h"
#include "V3Hash.h" #include "V3Hash.h"
#include <algorithm>
#include <cmath> #include <cmath>
#include <limits> #include <limits>
#include <vector> #include <vector>

View File

@ -99,8 +99,9 @@ void test(const string& lhss, const string& op, const string& rhss, const string
gotnum.opLogAnd(lhnum, rhnum); gotnum.opLogAnd(lhnum, rhnum);
} else if (op == "||") { } else if (op == "||") {
gotnum.opLogOr(lhnum, rhnum); gotnum.opLogOr(lhnum, rhnum);
} else } else {
v3fatalSrc("Bad opcode: " << op); v3fatalSrc("Bad opcode: " << op);
}
UINFO(0, "------- Test:\n" UINFO(0, "------- Test:\n"
<< " " << lhnum << " " << op << endl << " " << lhnum << " " << op << endl

View File

@ -271,9 +271,10 @@ string V3ParseGrammar::deQuote(FileLine* fileline, string text) {
} else if (isalnum(*cp)) { } else if (isalnum(*cp)) {
fileline->v3error("Unknown escape sequence: \\" << *cp); fileline->v3error("Unknown escape sequence: \\" << *cp);
break; break;
} else } else {
newtext += *cp; newtext += *cp;
} }
}
} else if (*cp == '\\') { } else if (*cp == '\\') {
quoted = true; quoted = true;
octal_digits = 0; octal_digits = 0;

View File

@ -26,6 +26,7 @@
#include "V3SymTable.h" #include "V3SymTable.h"
#include <deque> #include <deque>
#include <vector>
//###################################################################### //######################################################################
// Symbol table for parsing // Symbol table for parsing

View File

@ -24,6 +24,7 @@
#include "V3OrderGraph.h" #include "V3OrderGraph.h"
#include <list> #include <list>
#include <unordered_map>
class LogicMTask; class LogicMTask;
using Vx2MTaskMap = std::unordered_map<const MTaskMoveVertex*, LogicMTask*>; using Vx2MTaskMap = std::unordered_map<const MTaskMoveVertex*, LogicMTask*>;

View File

@ -29,8 +29,9 @@
#include "V3Error.h" #include "V3Error.h"
#include <set> #include <functional>
#include <map> #include <map>
#include <set>
#include <unordered_map> #include <unordered_map>
//###################################################################### //######################################################################

View File

@ -42,6 +42,8 @@
#include <deque> #include <deque>
#include <sstream> #include <sstream>
#include <stack>
#include <unordered_map>
#include <vector> #include <vector>
//============================================================================ //============================================================================

View File

@ -26,9 +26,11 @@
#include "V3String.h" #include "V3String.h"
#include <cstdarg> #include <cstdarg>
#include <map>
#include <iomanip> #include <iomanip>
#include <map>
#include <memory> #include <memory>
#include <unordered_set>
#include <vector>
class VSymGraph; class VSymGraph;
class VSymEnt; class VSymEnt;

View File

@ -23,6 +23,8 @@
#include "V3Error.h" #include "V3Error.h"
#include <vector>
namespace V3TSP { namespace V3TSP {
// Perform a "Traveling Salesman Problem" optimizing sort // Perform a "Traveling Salesman Problem" optimizing sort
// on any type you like -- so long as inherits from TspStateBase. // on any type you like -- so long as inherits from TspStateBase.

View File

@ -23,6 +23,7 @@
#include "V3Error.h" #include "V3Error.h"
#include "V3Ast.h" #include "V3Ast.h"
#include <utility>
#include <vector> #include <vector>
//============================================================================ //============================================================================

View File

@ -276,13 +276,13 @@ private:
UINFO(4, " COUNTBITS(" << dropop[0] << dropop[1] << dropop[2] << " " << nodep << endl); UINFO(4, " COUNTBITS(" << dropop[0] << dropop[1] << dropop[2] << " " << nodep << endl);
AstNode* nonXp = nullptr; AstNode* nonXp = nullptr;
if (!dropop[0]) if (!dropop[0]) {
nonXp = nodep->rhsp(); nonXp = nodep->rhsp();
else if (!dropop[1]) } else if (!dropop[1]) {
nonXp = nodep->thsp(); nonXp = nodep->thsp();
else if (!dropop[2]) } else if (!dropop[2]) {
nonXp = nodep->fhsp(); nonXp = nodep->fhsp();
else { // Was all X-s } else { // Was all X-s
UINFO(4, " COUNTBITS('x)->0 " << nodep << endl); UINFO(4, " COUNTBITS('x)->0 " << nodep << endl);
AstConst* const newp = new AstConst(nodep->fileline(), AstConst::BitFalse()); AstConst* const newp = new AstConst(nodep->fileline(), AstConst::BitFalse());
nodep->replaceWith(newp); nodep->replaceWith(newp);

View File

@ -21,6 +21,7 @@
#include "verilatedos.h" #include "verilatedos.h"
#include <map> #include <map>
#include <utility>
#include <vector> #include <vector>
//******************************************************************** //********************************************************************

View File

@ -21,6 +21,8 @@
#include <algorithm> #include <algorithm>
#include <fstream> #include <fstream>
#include <string>
#include <vector>
//###################################################################### //######################################################################