Fix some possible memory leaks and make some methods const.
This patch fixes a couple places where there were some memory leaks on error and also makes some methods const that can be. Found with cppcheck.
This commit is contained in:
parent
d33082bca5
commit
860f8627ba
6
async.cc
6
async.cc
|
|
@ -23,12 +23,12 @@
|
||||||
# include "netlist.h"
|
# include "netlist.h"
|
||||||
# include <cassert>
|
# include <cassert>
|
||||||
|
|
||||||
bool NetAssign::is_asynchronous()
|
bool NetAssign::is_asynchronous() const
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NetCondit::is_asynchronous()
|
bool NetCondit::is_asynchronous() const
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -82,7 +82,7 @@ bool NetProc::is_asynchronous()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NetProcTop::is_asynchronous()
|
bool NetProcTop::is_asynchronous() const
|
||||||
{
|
{
|
||||||
if (type_ == IVL_PR_INITIAL)
|
if (type_ == IVL_PR_INITIAL)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -1288,6 +1288,7 @@ static void line_directive()
|
||||||
if (cp == cpr) {
|
if (cp == cpr) {
|
||||||
VLerror(yylloc, "Invalid #line directive (missing space after "
|
VLerror(yylloc, "Invalid #line directive (missing space after "
|
||||||
"file name).");
|
"file name).");
|
||||||
|
delete[] buf;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
cp = cpr;
|
cp = cpr;
|
||||||
|
|
@ -1296,6 +1297,7 @@ static void line_directive()
|
||||||
unsigned long lineno = strtoul(cp, &cpr, 10);
|
unsigned long lineno = strtoul(cp, &cpr, 10);
|
||||||
if (cp == cpr) {
|
if (cp == cpr) {
|
||||||
VLerror(yylloc, "Invalid line number for #line directive.");
|
VLerror(yylloc, "Invalid line number for #line directive.");
|
||||||
|
delete[] buf;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
cp = cpr;
|
cp = cpr;
|
||||||
|
|
@ -1305,6 +1307,7 @@ static void line_directive()
|
||||||
if ((size_t)(cpr-yytext) != strlen(yytext)) {
|
if ((size_t)(cpr-yytext) != strlen(yytext)) {
|
||||||
VLerror(yylloc, "Invalid #line directive (extra garbage after "
|
VLerror(yylloc, "Invalid #line directive (extra garbage after "
|
||||||
"line number).");
|
"line number).");
|
||||||
|
delete[] buf;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2317,7 +2317,7 @@ class NetAssign : public NetAssignBase {
|
||||||
explicit NetAssign(NetAssign_*lv, NetExpr*rv);
|
explicit NetAssign(NetAssign_*lv, NetExpr*rv);
|
||||||
~NetAssign();
|
~NetAssign();
|
||||||
|
|
||||||
bool is_asynchronous();
|
bool is_asynchronous() const;
|
||||||
|
|
||||||
virtual bool emit_proc(struct target_t*) const;
|
virtual bool emit_proc(struct target_t*) const;
|
||||||
virtual int match_proc(struct proc_match_t*);
|
virtual int match_proc(struct proc_match_t*);
|
||||||
|
|
@ -2496,7 +2496,7 @@ class NetCondit : public NetProc {
|
||||||
virtual NexusSet* nex_input(bool rem_out = true);
|
virtual NexusSet* nex_input(bool rem_out = true);
|
||||||
virtual void nex_output(NexusSet&o);
|
virtual void nex_output(NexusSet&o);
|
||||||
|
|
||||||
bool is_asynchronous();
|
bool is_asynchronous() const;
|
||||||
bool synth_async(Design*des, NetScope*scope,
|
bool synth_async(Design*des, NetScope*scope,
|
||||||
const NetBus&nex_map, NetBus&nex_out);
|
const NetBus&nex_map, NetBus&nex_out);
|
||||||
|
|
||||||
|
|
@ -3162,7 +3162,7 @@ class NetProcTop : public LineInfo, public Attrib {
|
||||||
const NetScope*scope() const;
|
const NetScope*scope() const;
|
||||||
|
|
||||||
/* Return true if this process represents combinational logic. */
|
/* Return true if this process represents combinational logic. */
|
||||||
bool is_asynchronous();
|
bool is_asynchronous() const;
|
||||||
|
|
||||||
/* Create asynchronous logic from this thread and return true,
|
/* Create asynchronous logic from this thread and return true,
|
||||||
or return false if that cannot be done. */
|
or return false if that cannot be done. */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue