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 {
public:
static void cctorsAll();
private:
static void evalAsserts();
};
#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 addWaiver(V3ErrorCode code, const string& filename, const string& msg);
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 applyCoverageBlock(AstNodeModule* modulep, AstBegin* nodep);
static void applyIgnores(FileLine* filelinep);

View File

@ -38,7 +38,8 @@ protected:
V3EdgeFuncP m_edgeFuncp; // Function that says we follow this edge
// CONSTRUCTORS
GraphAlg(T_Graph* graphp, V3EdgeFuncP edgeFuncp)
: m_graphp(graphp), m_edgeFuncp(edgeFuncp) {}
: m_graphp(graphp)
, m_edgeFuncp(edgeFuncp) {}
~GraphAlg() {}
// METHODS
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.
vluint64_t m_generation;
public:
public:
// CONSTRUCTORS
explicit GraphPathChecker(const V3Graph* graphp,
V3EdgeFuncP edgeFuncp = V3GraphEdge::followAlwaysTrue);
@ -54,9 +54,8 @@ class GraphPathChecker : GraphAlg<const V3Graph> {
// removed. Detect such an edge.
bool isTransitiveEdge(const V3GraphEdge* edgep);
private:
bool pathExistsInternal(const V3GraphVertex* ap,
const V3GraphVertex* bp,
private:
bool pathExistsInternal(const V3GraphVertex* ap, const V3GraphVertex* bp,
unsigned* costp = NULL);
void initHalfCriticalPaths(GraphWay way, bool checkOnly);
void incGeneration() { ++m_generation; }

View File

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

View File

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

View File

@ -37,17 +37,22 @@ private:
vluint64_t m_bucketsCovered; ///< Num buckets with sufficient coverage
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; }
void allocate(vluint64_t point) {
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;
//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());
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;
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:
@ -60,7 +65,7 @@ public:
}
~VlcBuckets() {
m_dataSize = 0;
free(m_datap); m_datap=NULL;
free(m_datap); m_datap = NULL;
}
// ACCESSORS
@ -70,9 +75,9 @@ public:
// METHODS
void addData(vluint64_t point, vluint64_t hits) {
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);
m_datap[point/64] |= covBit(point);
m_datap[point / 64] |= covBit(point);
m_bucketsCovered++;
}
}
@ -80,55 +85,52 @@ public:
if (point >= m_dataSize) {
return;
} else {
m_datap[point/64] &= ~covBit(point);
m_datap[point / 64] &= ~covBit(point);
}
}
bool exists(vluint64_t point) const {
if (point >= m_dataSize) {
return false;
} 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 {
if (point >= m_dataSize) {
return 0;
} 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 pop = 0;
for (vluint64_t i=0; i<m_dataSize; i++) {
for (vluint64_t i = 0; i < m_dataSize; i++) {
if (hits(i)) pop++;
}
return pop;
}
vluint64_t dataPopCount(const VlcBuckets& remaining) {
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++;
}
return pop;
}
void orData(const VlcBuckets& ordata) {
for (vluint64_t i=0; i<m_dataSize; i++) {
if (hits(i) && ordata.hits(i)) {
clearHits(i);
}
for (vluint64_t i = 0; i < m_dataSize; i++) {
if (hits(i) && ordata.hits(i)) clearHits(i);
}
}
void dump() const {
cout<<"# ";
for (vluint64_t i=0; i<m_dataSize; i++) {
if (hits(i)) cout<<","<<i;
cout << "# ";
for (vluint64_t i = 0; i < m_dataSize; i++) {
if (hits(i)) cout << "," << i;
}
cout<<endl;
cout << endl;
}
};
//######################################################################
#endif // guard

View File

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

View File

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

View File

@ -60,7 +60,7 @@ public:
// METHODS
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 rank();