-
Notifications
You must be signed in to change notification settings - Fork 585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
odb: protecting LefParser and DefParser namespaces #6475
base: master
Are you sure you want to change the base?
odb: protecting LefParser and DefParser namespaces #6475
Conversation
Signed-off-by: Lucas Yuki Imamura <[email protected]>
Signed-off-by: Lucas Yuki Imamura <[email protected]>
Signed-off-by: Lucas Yuki Imamura <[email protected]>
Signed-off-by: Lucas Yuki Imamura <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
{ | ||
odb::dbTechLayerCutSpacingTableOrthRule* rule | ||
= odb::dbTechLayerCutSpacingTableOrthRule::create(parser->layer); | ||
std::vector<std::pair<int, int>> table; | ||
for (const auto& item : params) | ||
table.push_back( | ||
{lefin->dbdist(at_c<0>(item)), lefin->dbdist(at_c<1>(item))}); | ||
table.push_back({lefinReader->dbdist(at_c<0>(item)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: 'push_back' is called inside a loop; consider pre-allocating the container capacity before the loop [performance-inefficient-vector-operation]
src/odb/src/lefin/lefTechLayerCutSpacingTableParser.cpp:46:
- for (const auto& item : params)
+ table.reserve(params.size());
+ for (const auto& item : params)
table.push_back({lefinReader->dbdist(at_c<0>(item)), | ||
lefinReader->dbdist(at_c<1>(item))}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: use emplace_back instead of push_back [modernize-use-emplace]
table.push_back({lefinReader->dbdist(at_c<0>(item)), | |
lefinReader->dbdist(at_c<1>(item))}); | |
table.emplace_back(lefinReader->dbdist(at_c<0>(item)), | |
lefinReader->dbdist(at_c<1>(item))); |
@@ -110,11 +111,11 @@ void lefin::init() | |||
} | |||
} | |||
|
|||
lefin::~lefin() | |||
lefinReader::~lefinReader() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: use '= default' to define a trivial destructor [modernize-use-equals-default]
src/odb/src/lefin/lefin.cpp:114:
- {
- }
+ = default;
std::mutex defin::_def_mutex; | ||
|
||
defin::defin(dbDatabase* db, utl::Logger* logger, MODE mode) | ||
{ | ||
std::lock_guard<std::mutex> lock(_def_mutex); | ||
_reader = new definReader(db, logger, mode); | ||
} | ||
|
||
defin::~defin() | ||
{ | ||
std::lock_guard<std::mutex> lock(_def_mutex); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not clear the locking is doing anything here. It kind of looks like this is trying to protect two defin's from running at the same time on the same database, but what we're really concerned about is two different defin's running on two different databases.
What are these locks here to do?
Protects the global and static variables in the LefParser and DefParser namespaces (issue #5981)
Changes: