This commit is contained in:
James Cherry 2021-02-07 17:22:59 +00:00
parent e3d60f0b8c
commit 6359bd6fc5
4 changed files with 26 additions and 16 deletions

View File

@ -522,8 +522,13 @@ libertyIncludeBegin(const char *filename)
liberty_filename = filename;
liberty_line = 1;
}
else
libertyParseError("cannot open include file %s.", filename);
else {
// Copy the filename to the stack so it is deleted when
// libertyParseError throws an error.
string filename1(filename);
stringDelete(filename);
libertyParseError("cannot open include file %s.", filename1.c_str());
}
return stream;
}

View File

@ -600,6 +600,7 @@ LibertyReader::endLibraryAttrs(LibertyGroup *group)
else
libWarn(31, group, "default_wire_load %s not found.", default_wireload_);
stringDelete(default_wireload_);
default_wireload_ = nullptr;
}
if (default_wireload_selection_) {
@ -611,6 +612,7 @@ LibertyReader::endLibraryAttrs(LibertyGroup *group)
libWarn(32, group, "default_wire_selection %s not found.",
default_wireload_selection_);
stringDelete(default_wireload_selection_);
default_wireload_selection_ = nullptr;
}
if (default_operating_condition_) {
@ -622,6 +624,7 @@ LibertyReader::endLibraryAttrs(LibertyGroup *group)
libWarn(60, group, "default_operating_condition %s not found.",
default_operating_condition_);
stringDelete(default_operating_condition_);
default_operating_condition_ = nullptr;
}
bool missing_threshold = false;
@ -1074,8 +1077,10 @@ LibertyReader::visitDefaultWireLoad(LibertyAttr *attr)
{
if (library_) {
const char *value = getAttrString(attr);
if (value)
if (value) {
stringDelete(default_wireload_);
default_wireload_ = stringCopy(value);
}
}
}
@ -1100,8 +1105,10 @@ LibertyReader::visitDefaultWireLoadSelection(LibertyAttr *attr)
{
if (library_) {
const char *value = getAttrString(attr);
if (value)
if (value) {
stringDelete(default_wireload_selection_);
default_wireload_selection_ = stringCopy(value);
}
}
}
@ -1110,8 +1117,10 @@ LibertyReader::visitDefaultOperatingConditions(LibertyAttr *attr)
{
if (library_) {
const char *value = getAttrString(attr);
if (value)
if (value) {
stringDelete(default_operating_condition_);
default_operating_condition_ = stringCopy(value);
}
}
}

View File

@ -60,6 +60,7 @@ write_verilog_cmd(const char *filename,
Sta *sta = Sta::sta();
Network *network = sta->network();
writeVerilog(filename, sort, include_pwr_gnd, remove_cells, network);
delete remove_cells;
}
%} // inline

View File

@ -80,7 +80,10 @@ public:
const char *msg,
bool warn);
~VerilogError();
void report(Report *report);
const char *msg() const { return msg_; }
const char *filename() const { return filename_; }
int id() const { return id_; }
int line() const { return line_; }
bool warn() const { return warn_; }
private:
@ -114,15 +117,6 @@ VerilogError::~VerilogError()
stringDelete(msg_);
}
void
VerilogError::report(Report *report)
{
if (warn_)
report->fileWarn(id_, filename_, line_, "%s", msg_);
else
report->fileError(id_, filename_, line_, "%s", msg_);
}
class VerilogErrorCmp
{
public:
@ -2224,7 +2218,8 @@ VerilogReader::reportLinkErrors(Report *report)
VerilogErrorSeq::Iterator error_iter(link_errors_);
while (error_iter.hasNext()) {
VerilogError *error = error_iter.next();
error->report(report);
// Report as warnings to avoid throwing.
report->fileWarn(error->id(), error->filename(), error->line(), "%s", error->msg());
errors |= !error->warn();
delete error;
}