Skip to content

Fix 3dblox parser error#10089

Open
openroad-ci wants to merge 3 commits intoThe-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:fix-3dblox-parser-error
Open

Fix 3dblox parser error#10089
openroad-ci wants to merge 3 commits intoThe-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:fix-3dblox-parser-error

Conversation

@openroad-ci
Copy link
Copy Markdown
Collaborator

fix #10076

Signed-off-by: Jorge Ferreira <jorge.ferreira@precisioninno.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

clang-tidy review says "All clean, LGTM! 👍"

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request enhances error reporting by automatically including the file path in BaseParser::logError and updating derived parsers to avoid redundant filename logging. Feedback suggests utilizing the logger's formatting capabilities in baseParser.cpp to avoid manual string concatenation and removing repetitive 'Parser Error' prefixes in the calls from dbvParser.cpp and dbxParser.cpp to prevent redundant output.

Comment on lines +177 to +181
std::string msg = message;
if (!current_file_path_.empty()) {
msg = "in " + current_file_path_ + ": " + message;
}
logger_->error(utl::ODB, 521, "Parser Error: {} ", msg);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The error message construction contains an unnecessary trailing space in the format string and involves manual string concatenation. It is cleaner to use the logger's formatting capabilities directly to include the file path context. Note that calls to logger_->error are expected to terminate the program, so additional error handling is not necessary.

Suggested change
std::string msg = message;
if (!current_file_path_.empty()) {
msg = "in " + current_file_path_ + ": " + message;
}
logger_->error(utl::ODB, 521, "Parser Error: {} ", msg);
if (!current_file_path_.empty()) {
logger_->error(utl::ODB, 521, "Parser Error in {}: {}", current_file_path_, message);
} else {
logger_->error(utl::ODB, 521, "Parser Error: {}", message);
}
References
  1. Calls to logger_->error are expected to terminate the program, so additional error handling like returning an error code or throwing an exception is not necessary.

std::ifstream file(filename);
if (!file.is_open()) {
logError("3DBV Parser Error: Cannot open file: " + filename);
logError("3DBV Parser Error: Cannot open file");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The logError function already prefixes the message with "Parser Error:". Including "Parser Error" in the argument leads to redundant output (e.g., "Parser Error: ... 3DBV Parser Error: ...").

Suggested change
logError("3DBV Parser Error: Cannot open file");
logError("3DBV: Cannot open file");

std::ifstream file(filename);
if (!file.is_open()) {
logError("DBX Parser Error: Cannot open file: " + filename);
logError("DBX Parser Error: Cannot open file");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The logError function already prefixes the message with "Parser Error:". Including "Parser Error" in the argument leads to redundant output (e.g., "Parser Error: ... DBX Parser Error: ...").

Suggested change
logError("DBX Parser Error: Cannot open file");
logError("DBX: Cannot open file");

@jferreiraOpenRoad
Copy link
Copy Markdown
Contributor

The fix centralizes the file path in the 3dblox parser error report. Redundancies in dbxParser.cpp and dbvParser.cpp have been removed.

Signed-off-by: Jorge Ferreira <jorge.ferreira@precisioninno.com>
@github-actions github-actions bot added the size/S label Apr 8, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

clang-tidy review says "All clean, LGTM! 👍"

void BaseParser::logError(const std::string& message)
{
logger_->error(utl::ODB, 521, "Parser Error: {}", message);
if (!current_file_path_.empty()) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would that ever happen?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would that ever happen?

That's right, sorry for the mistake, I've already corrected it.

std::ifstream file(filename);
if (!file.is_open()) {
logError("3DBV Parser Error: Cannot open file: " + filename);
logError("3DBV Parser Error: Cannot open file");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
logError("3DBV Parser Error: Cannot open file");
logError("Cannot open file");

std::ifstream file(filename);
if (!file.is_open()) {
logError("DBX Parser Error: Cannot open file: " + filename);
logError("DBX Parser Error: Cannot open file");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
logError("DBX Parser Error: Cannot open file");
logError("Cannot open file");

Comment on lines +178 to +182
logger_->error(
utl::ODB, 521, "Parser Error in {}: {}", current_file_path_, message);
} else {
logger_->error(utl::ODB, 521, "Parser Error: {}", message);
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not use the same error code for 2 separate errors.

Remove unreachable else branch in BaseParser::logError and
simplify error messages in DbvParser and DbxParser by removing
redundant prefixes already included by logError.

Signed-off-by: Jorge Ferreira <jorge.ferreira@precisioninno.com>
@github-actions github-actions bot added size/XS and removed size/S labels Apr 9, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

clang-tidy review says "All clean, LGTM! 👍"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ODB: incldue the file path in the 3dblox parser error messages

3 participants