Fix internals to make null-pointer-check clean. Also add more const's. No functional change intended, but likely something will break.

This commit is contained in:
Wilson Snyder
2018-02-01 21:32:58 -05:00
parent 94e8cf1de9
commit 597d28b505
73 changed files with 1421 additions and 1373 deletions
+2 -2
View File
@@ -68,7 +68,7 @@ private:
// True iff there's exactly one instance of this module in the design.
int instances = 0;
for (AstNode* stmtp = modp->stmtsp(); stmtp; stmtp=stmtp->nextp()) {
if (stmtp->castScope()) {
if (VN_IS(stmtp, Scope)) {
if (++instances > 1) { return false; }
}
}
@@ -187,7 +187,7 @@ private:
funcp->declPrivate(true);
AstNode* argsp = NULL;
for (AstNode* stmtp = newfuncp->argsp(); stmtp; stmtp=stmtp->nextp()) {
if (AstVar* portp = stmtp->castVar()) {
if (AstVar* portp = VN_CAST(stmtp, Var)) {
if (portp->isIO() && !portp->isFuncReturn()) {
AstNode* newp = new AstVarRef(portp->fileline(), portp, portp->isOutput());
if (argsp) argsp = argsp->addNextNull(newp);