Internals: clang-format cleanups. No functional change.

This commit is contained in:
Wilson Snyder 2020-03-15 23:20:33 -04:00
parent 92d62a6568
commit c2b49f0174
10 changed files with 66 additions and 64 deletions

View File

@ -32,9 +32,9 @@
class V3CCtors { class V3CCtors {
public: public:
static void cctorsAll(); static void cctorsAll();
private: private:
static void evalAsserts(); static void evalAsserts();
}; };
#endif // Guard #endif // Guard

View File

@ -39,7 +39,8 @@ public:
static void addIgnore(V3ErrorCode code, bool on, const string& filename, int min, int max); static void addIgnore(V3ErrorCode code, bool on, const string& filename, int min, int max);
static void addWaiver(V3ErrorCode code, const string& filename, const string& msg); static void addWaiver(V3ErrorCode code, const string& filename, const string& msg);
static void addInline(FileLine* fl, const string& module, const string& ftask, bool on); static void addInline(FileLine* fl, const string& module, const string& ftask, bool on);
static void addVarAttr(FileLine* fl, const string& module, const string& ftask, const string& signal, AstAttrType type, AstSenTree* nodep); static void addVarAttr(FileLine* fl, const string& module, const string& ftask,
const string& signal, AstAttrType type, AstSenTree* nodep);
static void applyCase(AstCase* nodep); static void applyCase(AstCase* nodep);
static void applyCoverageBlock(AstNodeModule* modulep, AstBegin* nodep); static void applyCoverageBlock(AstNodeModule* modulep, AstBegin* nodep);
static void applyIgnores(FileLine* filelinep); static void applyIgnores(FileLine* filelinep);

View File

@ -38,7 +38,8 @@ protected:
V3EdgeFuncP m_edgeFuncp; // Function that says we follow this edge V3EdgeFuncP m_edgeFuncp; // Function that says we follow this edge
// CONSTRUCTORS // CONSTRUCTORS
GraphAlg(T_Graph* graphp, V3EdgeFuncP edgeFuncp) GraphAlg(T_Graph* graphp, V3EdgeFuncP edgeFuncp)
: m_graphp(graphp), m_edgeFuncp(edgeFuncp) {} : m_graphp(graphp)
, m_edgeFuncp(edgeFuncp) {}
~GraphAlg() {} ~GraphAlg() {}
// METHODS // METHODS
inline bool followEdge(V3GraphEdge* edgep) { inline bool followEdge(V3GraphEdge* edgep) {

View File

@ -40,7 +40,7 @@ class GraphPathChecker : GraphAlg<const V3Graph> {
// through the same node twice while searching for a path. // through the same node twice while searching for a path.
vluint64_t m_generation; vluint64_t m_generation;
public: public:
// CONSTRUCTORS // CONSTRUCTORS
explicit GraphPathChecker(const V3Graph* graphp, explicit GraphPathChecker(const V3Graph* graphp,
V3EdgeFuncP edgeFuncp = V3GraphEdge::followAlwaysTrue); V3EdgeFuncP edgeFuncp = V3GraphEdge::followAlwaysTrue);
@ -54,9 +54,8 @@ class GraphPathChecker : GraphAlg<const V3Graph> {
// removed. Detect such an edge. // removed. Detect such an edge.
bool isTransitiveEdge(const V3GraphEdge* edgep); bool isTransitiveEdge(const V3GraphEdge* edgep);
private: private:
bool pathExistsInternal(const V3GraphVertex* ap, bool pathExistsInternal(const V3GraphVertex* ap, const V3GraphVertex* bp,
const V3GraphVertex* bp,
unsigned* costp = NULL); unsigned* costp = NULL);
void initHalfCriticalPaths(GraphWay way, bool checkOnly); void initHalfCriticalPaths(GraphWay way, bool checkOnly);
void incGeneration() { ++m_generation; } void incGeneration() { ++m_generation; }

View File

@ -33,6 +33,7 @@ class V3LinkLevel {
private: private:
static void wrapTopCell(AstNetlist* rootp); static void wrapTopCell(AstNetlist* rootp);
static void wrapTopPackages(AstNetlist* rootp); static void wrapTopPackages(AstNetlist* rootp);
public: public:
static void modSortByLevel(); static void modSortByLevel();
static void wrapTop(AstNetlist* rootp); static void wrapTop(AstNetlist* rootp);

View File

@ -40,6 +40,7 @@ private:
// CONSTRUCTORS // CONSTRUCTORS
VL_UNCOPYABLE(V3Parse); VL_UNCOPYABLE(V3Parse);
public: public:
// We must allow reading multiple files into one parser // We must allow reading multiple files into one parser
V3Parse(AstNetlist* rootp, VInFilter* filterp, V3ParseSym* symp); V3Parse(AstNetlist* rootp, VInFilter* filterp, V3ParseSym* symp);

View File

@ -37,17 +37,22 @@ private:
vluint64_t m_bucketsCovered; ///< Num buckets with sufficient coverage vluint64_t m_bucketsCovered; ///< Num buckets with sufficient coverage
private: private:
static inline vluint64_t covBit(vluint64_t point) { return 1ULL<<(point & 63); } static inline vluint64_t covBit(vluint64_t point) { return 1ULL << (point & 63); }
inline vluint64_t allocSize() const { return sizeof(vluint64_t) * m_dataSize / 64; } inline vluint64_t allocSize() const { return sizeof(vluint64_t) * m_dataSize / 64; }
void allocate(vluint64_t point) { void allocate(vluint64_t point) {
vluint64_t oldsize = m_dataSize; vluint64_t oldsize = m_dataSize;
if (m_dataSize<point) m_dataSize=(point+64) & ~63ULL; // Keep power of two if (m_dataSize < point) m_dataSize = (point + 64) & ~63ULL; // Keep power of two
m_dataSize *= 2; m_dataSize *= 2;
//UINFO(9, "Realloc "<<allocSize()<<" for "<<point<<" "<<cvtToHex(m_datap)<<endl); // UINFO(9, "Realloc "<<allocSize()<<" for "<<point<<" "<<cvtToHex(m_datap)<<endl);
vluint64_t* newp = (vluint64_t*)realloc(m_datap, allocSize()); vluint64_t* newp = (vluint64_t*)realloc(m_datap, allocSize());
if (!newp) { free(m_datap); v3fatal("Out of memory increasing buckets"); } if (!newp) {
free(m_datap);
v3fatal("Out of memory increasing buckets");
}
m_datap = newp; m_datap = newp;
for (vluint64_t i=oldsize; i<m_dataSize; i+=64) m_datap[i/64] = 0; for (vluint64_t i = oldsize; i < m_dataSize; i += 64) {
m_datap[i / 64] = 0;
}
} }
public: public:
@ -60,7 +65,7 @@ public:
} }
~VlcBuckets() { ~VlcBuckets() {
m_dataSize = 0; m_dataSize = 0;
free(m_datap); m_datap=NULL; free(m_datap); m_datap = NULL;
} }
// ACCESSORS // ACCESSORS
@ -70,9 +75,9 @@ public:
// METHODS // METHODS
void addData(vluint64_t point, vluint64_t hits) { void addData(vluint64_t point, vluint64_t hits) {
if (hits >= sufficient()) { if (hits >= sufficient()) {
//UINFO(9," addData "<<point<<" "<<hits<<" size="<<m_dataSize<<endl); // UINFO(9," addData "<<point<<" "<<hits<<" size="<<m_dataSize<<endl);
if (point >= m_dataSize) allocate(point); if (point >= m_dataSize) allocate(point);
m_datap[point/64] |= covBit(point); m_datap[point / 64] |= covBit(point);
m_bucketsCovered++; m_bucketsCovered++;
} }
} }
@ -80,55 +85,52 @@ public:
if (point >= m_dataSize) { if (point >= m_dataSize) {
return; return;
} else { } else {
m_datap[point/64] &= ~covBit(point); m_datap[point / 64] &= ~covBit(point);
} }
} }
bool exists(vluint64_t point) const { bool exists(vluint64_t point) const {
if (point >= m_dataSize) { if (point >= m_dataSize) {
return false; return false;
} else { } else {
return (m_datap[point/64] & covBit(point)) ? 1:0; return (m_datap[point / 64] & covBit(point)) ? 1 : 0;
} }
} }
vluint64_t hits(vluint64_t point) const { vluint64_t hits(vluint64_t point) const {
if (point >= m_dataSize) { if (point >= m_dataSize) {
return 0; return 0;
} else { } else {
return (m_datap[point/64] & covBit(point)) ? 1:0; return (m_datap[point / 64] & covBit(point)) ? 1 : 0;
} }
} }
vluint64_t popCount() const { vluint64_t popCount() const {
vluint64_t pop = 0; vluint64_t pop = 0;
for (vluint64_t i=0; i<m_dataSize; i++) { for (vluint64_t i = 0; i < m_dataSize; i++) {
if (hits(i)) pop++; if (hits(i)) pop++;
} }
return pop; return pop;
} }
vluint64_t dataPopCount(const VlcBuckets& remaining) { vluint64_t dataPopCount(const VlcBuckets& remaining) {
vluint64_t pop = 0; vluint64_t pop = 0;
for (vluint64_t i=0; i<m_dataSize; i++) { for (vluint64_t i = 0; i < m_dataSize; i++) {
if (hits(i) && remaining.hits(i)) pop++; if (hits(i) && remaining.hits(i)) pop++;
} }
return pop; return pop;
} }
void orData(const VlcBuckets& ordata) { void orData(const VlcBuckets& ordata) {
for (vluint64_t i=0; i<m_dataSize; i++) { for (vluint64_t i = 0; i < m_dataSize; i++) {
if (hits(i) && ordata.hits(i)) { if (hits(i) && ordata.hits(i)) clearHits(i);
clearHits(i);
}
} }
} }
void dump() const { void dump() const {
cout<<"# "; cout << "# ";
for (vluint64_t i=0; i<m_dataSize; i++) { for (vluint64_t i = 0; i < m_dataSize; i++) {
if (hits(i)) cout<<","<<i; if (hits(i)) cout << "," << i;
} }
cout<<endl; cout << endl;
} }
}; };
//###################################################################### //######################################################################
#endif // guard #endif // guard

View File

@ -71,26 +71,26 @@ public:
const string namestr = name(); const string namestr = name();
for (const char* cp = namestr.c_str(); *cp; ++cp) { for (const char* cp = namestr.c_str(); *cp; ++cp) {
if (*cp == '\001') { if (*cp == '\001') {
if (0==strncmp(cp+1, shortKey, shortLen) if (0 == strncmp(cp + 1, shortKey, shortLen)
&& cp[shortLen+1] == '\002') { && cp[shortLen + 1] == '\002') {
cp += shortLen+2; // Skip \001+short+\002 cp += shortLen + 2; // Skip \001+short+\002
const char* ep = cp; const char* ep = cp;
while (*ep && *ep != '\001') ++ep; while (*ep && *ep != '\001') ++ep;
return string(cp, ep-cp); return string(cp, ep - cp);
} }
} }
} }
return ""; return "";
} }
static void dumpHeader() { static void dumpHeader() {
cout<<"Points:\n"; cout << "Points:\n";
cout<<" Num, TestsCover, Count, Name"<<endl; cout << " Num, TestsCover, Count, Name" << endl;
} }
void dump() const { void dump() const {
cout<<" "<<std::setw(8)<<std::setfill('0')<<pointNum() cout << " " << std::setw(8) << std::setfill('0') << pointNum();
<<", "<<std::setw(7)<<std::setfill(' ')<<testsCovering() cout << ", " << std::setw(7) << std::setfill(' ') << testsCovering();
<<", "<<std::setw(7)<<std::setfill(' ')<<count() cout << ", " << std::setw(7) << std::setfill(' ') << count();
<<", \""<<name()<<"\""<<endl; cout << ", \"" << name() << "\"" << endl;
} }
}; };
@ -100,7 +100,7 @@ public:
class VlcPoints { class VlcPoints {
private: private:
// MEMBERS // MEMBERS
typedef std::map<string,vluint64_t> NameMap; // Sorted by name (ordered) typedef std::map<string, vluint64_t> NameMap; // Sorted by name (ordered)
NameMap m_nameMap; //< Name to point-number NameMap m_nameMap; //< Name to point-number
std::vector<VlcPoint> m_points; //< List of all points std::vector<VlcPoint> m_points; //< List of all points
vluint64_t m_numPoints; //< Total unique points vluint64_t m_numPoints; //< Total unique points
@ -114,33 +114,28 @@ public:
public: public:
// CONSTRUCTORS // CONSTRUCTORS
VlcPoints() { VlcPoints() : m_numPoints(0) {}
m_numPoints = 0;
}
~VlcPoints() {} ~VlcPoints() {}
// METHODS // METHODS
void dump() { void dump() {
UINFO(2,"dumpPoints...\n"); UINFO(2, "dumpPoints...\n");
VlcPoint::dumpHeader(); VlcPoint::dumpHeader();
for (VlcPoints::ByName::const_iterator it = begin(); it != end(); ++it) { for (VlcPoints::ByName::const_iterator it = begin(); it != end(); ++it) {
const VlcPoint& point = pointNumber(it->second); const VlcPoint& point = pointNumber(it->second);
point.dump(); point.dump();
} }
} }
VlcPoint& pointNumber(vluint64_t num) { VlcPoint& pointNumber(vluint64_t num) { return m_points[num]; }
return m_points[num];
}
vluint64_t findAddPoint(const string& name, vluint64_t count) { vluint64_t findAddPoint(const string& name, vluint64_t count) {
vluint64_t pointnum; vluint64_t pointnum;
NameMap::const_iterator iter = m_nameMap.find(name); NameMap::const_iterator iter = m_nameMap.find(name);
if (iter != m_nameMap.end()) { if (iter != m_nameMap.end()) {
pointnum = iter->second; pointnum = iter->second;
m_points[pointnum].countInc(count); m_points[pointnum].countInc(count);
} } else {
else {
pointnum = m_numPoints++; pointnum = m_numPoints++;
VlcPoint point (name, pointnum); VlcPoint point(name, pointnum);
point.countInc(count); point.countInc(count);
m_points.push_back(point); m_points.push_back(point);
m_nameMap.insert(make_pair(point.name(), point.pointNum())); m_nameMap.insert(make_pair(point.name(), point.pointNum()));

View File

@ -71,19 +71,20 @@ public:
// METHODS // METHODS
static void dumpHeader() { static void dumpHeader() {
cout<<"Tests:\n"; cout << "Tests:\n";
//cout<<" Testrun, Computrons,"; // Currently not loaded // cout<<" Testrun, Computrons,"; // Currently not loaded
cout<<" Covered, Rank, RankPts, Filename"<<endl; cout << " Covered, Rank, RankPts, Filename" << endl;
} }
void dump(bool bucketsToo) { void dump(bool bucketsToo) {
if (testrun() || computrons()!=0.0) { // currently unused // LCOV_EXCL_LINE if (testrun() || computrons() != 0.0) { // currently unused // LCOV_EXCL_LINE
cout<<" "<<std::setw(8)<<std::setfill('0')<<testrun() // LCOV_EXCL_LINE cout << " " << std::setw(8) << std::setfill('0') << testrun() // LCOV_EXCL_LINE
<<", "<<std::setw(7)<<std::setfill(' ')<<computrons()<<","; // LCOV_EXCL_LINE << ", " << std::setw(7) << std::setfill(' ') << computrons()
<< ","; // LCOV_EXCL_LINE
} }
cout<<" "<<std::setw(7)<<std::setfill(' ')<<bucketsCovered() cout << " " << std::setw(7) << std::setfill(' ') << bucketsCovered();
<<", "<<std::setw(7)<<std::setfill(' ')<<rank() cout << ", " << std::setw(7) << std::setfill(' ') << rank();
<<", "<<std::setw(7)<<std::setfill(' ')<<rankPoints() cout << ", " << std::setw(7) << std::setfill(' ') << rankPoints();
<<", \""<<name()<<"\""<<endl; cout << ", \"" << name() << "\"" << endl;
if (bucketsToo) m_buckets.dump(); if (bucketsToo) m_buckets.dump();
} }
}; };
@ -95,6 +96,7 @@ class VlcTests {
public: public:
// TYPES // TYPES
typedef std::vector<VlcTest*> ByName; typedef std::vector<VlcTest*> ByName;
private: private:
// MEMBERS // MEMBERS
ByName m_tests; //< List of all tests ByName m_tests; //< List of all tests
@ -109,14 +111,14 @@ public:
// CONSTRUCTORS // CONSTRUCTORS
VlcTests() {} VlcTests() {}
~VlcTests() { ~VlcTests() {
for (VlcTests::ByName::iterator it=begin(); it!=end(); ++it) { for (VlcTests::ByName::iterator it = begin(); it != end(); ++it) {
VL_DO_CLEAR(delete *it, *it=NULL); VL_DO_CLEAR(delete *it, *it = NULL);
} }
} }
// METHODS // METHODS
void dump(bool bucketsToo) { void dump(bool bucketsToo) {
UINFO(2,"dumpTests...\n"); UINFO(2, "dumpTests...\n");
VlcTest::dumpHeader(); VlcTest::dumpHeader();
for (VlcTests::ByName::const_iterator it = begin(); it != end(); ++it) { for (VlcTests::ByName::const_iterator it = begin(); it != end(); ++it) {
(*it)->dump(bucketsToo); (*it)->dump(bucketsToo);

View File

@ -60,7 +60,7 @@ public:
// METHODS // METHODS
void annotate(const string& dirname); void annotate(const string& dirname);
void readCoverage(const string& filename, bool nonfatal=false); void readCoverage(const string& filename, bool nonfatal = false);
void writeCoverage(const string& filename); void writeCoverage(const string& filename);
void rank(); void rank();