Skip to content

rmp: adjust naming to Google-style (excluding method names)#10193

Merged
maliberty merged 1 commit into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:rmp-tidy-naming
Apr 19, 2026
Merged

rmp: adjust naming to Google-style (excluding method names)#10193
maliberty merged 1 commit into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:rmp-tidy-naming

Conversation

@openroad-ci

Copy link
Copy Markdown
Member

Summary

adjust naming to Google-style (excluding method names)

Type of Change

  • Refactoring

Impact

None

Verification

  • I have verified that the local build succeeds (./etc/Build.sh).
  • I have run the relevant tests and they pass.
  • My code follows the repository's formatting guidelines.
  • I have signed my commits (DCO).

Signed-off-by: Matt Liberty <mliberty@precisioninno.com>

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

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.

Code Review

This pull request refactors naming conventions for enums and variables to a consistent style and adds linting suppressions for external library declarations. Feedback focuses on optimizing loops in Restructure.cpp by using references to avoid string copies and caching redundant function calls, as well as improving readability by storing repeated boolean conditions.

Comment on lines +375 to 381
for (auto pin_name : *error) {
debugPrint(logger_, RMP, "remap", 1, "Unconstrained pin: {}", pin_name);
if (!first && open_sta_->getDbNetwork()->findPin(pin_name.c_str())) {
ends.insert(open_sta_->getDbNetwork()->findPin(pin_name.c_str()));
}
first = false;
}

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

Iterating by value causes unnecessary string copies. Additionally, following the principle of analyzing loop structures to avoid redundancy, findPin should not be called multiple times for the same pin. Consider using a reference and caching the result to improve efficiency.

Suggested change
for (auto pin_name : *error) {
debugPrint(logger_, RMP, "remap", 1, "Unconstrained pin: {}", pin_name);
if (!first && open_sta_->getDbNetwork()->findPin(pin_name.c_str())) {
ends.insert(open_sta_->getDbNetwork()->findPin(pin_name.c_str()));
}
first = false;
}
for (const auto& pin_name : *error) {
debugPrint(logger_, RMP, "remap", 1, "Unconstrained pin: {}", pin_name);
if (!first) {
if (auto* pin = open_sta_->getDbNetwork()->findPin(pin_name.c_str())) {
ends.insert(pin);
}
}
first = false;
}
References
  1. When analyzing code within a loop, consider the entire loop structure to identify and remove redundant operations within the loop body.

Comment on lines +386 to 392
for (auto pin_name : *error) {
debugPrint(logger_, RMP, "remap", 1, "Unclocked pin: {}", pin_name);
if (!first && open_sta_->getDbNetwork()->findPin(pin_name.c_str())) {
ends.insert(open_sta_->getDbNetwork()->findPin(pin_name.c_str()));
}
first = false;
}

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

Iterating by value causes unnecessary string copies. Additionally, following the principle of analyzing loop structures to avoid redundancy, findPin should not be called multiple times for the same pin. Consider using a reference and caching the result to improve efficiency.

      for (const auto& pin_name : *error) {
        debugPrint(logger_, RMP, "remap", 1, "Unclocked pin: {}", pin_name);
        if (!first) {
          if (auto* pin = open_sta_->getDbNetwork()->findPin(pin_name.c_str())) {
            ends.insert(pin);
          }
        }
        first = false;
      }
References
  1. When analyzing code within a loop, consider the entire loop structure to identify and remove redundant operations within the loop body.

Comment on lines +469 to +473
odb::dbMaster* const_master = (pin_val == sta::LogicValue::one)
? hicell_master
: locell_master;
odb::dbMTerm* const_port
= (pinVal == sta::LogicValue::one) ? hiterm : loterm;
= (pin_val == sta::LogicValue::one) ? hiterm : loterm;

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 condition pin_val == sta::LogicValue::one is evaluated twice. Storing the result in a descriptive boolean variable improves readability and provides a minor performance optimization.

Suggested change
odb::dbMaster* const_master = (pin_val == sta::LogicValue::one)
? hicell_master
: locell_master;
odb::dbMTerm* const_port
= (pinVal == sta::LogicValue::one) ? hiterm : loterm;
= (pin_val == sta::LogicValue::one) ? hiterm : loterm;
const bool is_one = (pin_val == sta::LogicValue::one);
odb::dbMaster* const_master = is_one ? hicell_master : locell_master;
odb::dbMTerm* const_port = is_one ? hiterm : loterm;

@github-actions github-actions Bot left a comment

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.

clang-tidy made some suggestions

debugPrint(logger_, RMP, "remap", 1, "Unconstrained pin: {}", pinName);
if (!first && open_sta_->getDbNetwork()->findPin(pinName.c_str())) {
ends.insert(open_sta_->getDbNetwork()->findPin(pinName.c_str()));
for (auto pin_name : *error) {

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.

warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]

Suggested change
for (auto pin_name : *error) {
for (const auto& pin_name : *error) {

ends.insert(open_sta_->getDbNetwork()->findPin(pinName.c_str()));
for (auto pin_name : *error) {
debugPrint(logger_, RMP, "remap", 1, "Unconstrained pin: {}", pin_name);
if (!first && open_sta_->getDbNetwork()->findPin(pin_name.c_str())) {

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.

warning: redundant call to 'c_str' [readability-redundant-string-cstr]

Suggested change
if (!first && open_sta_->getDbNetwork()->findPin(pin_name.c_str())) {
if (!first && open_sta_->getDbNetwork()->findPin(pin_name)) {

for (auto pin_name : *error) {
debugPrint(logger_, RMP, "remap", 1, "Unconstrained pin: {}", pin_name);
if (!first && open_sta_->getDbNetwork()->findPin(pin_name.c_str())) {
ends.insert(open_sta_->getDbNetwork()->findPin(pin_name.c_str()));

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.

warning: redundant call to 'c_str' [readability-redundant-string-cstr]

Suggested change
ends.insert(open_sta_->getDbNetwork()->findPin(pin_name.c_str()));
ends.insert(open_sta_->getDbNetwork()->findPin(pin_name));

debugPrint(logger_, RMP, "remap", 1, "Unclocked pin: {}", pinName);
if (!first && open_sta_->getDbNetwork()->findPin(pinName.c_str())) {
ends.insert(open_sta_->getDbNetwork()->findPin(pinName.c_str()));
for (auto pin_name : *error) {

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.

warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]

Suggested change
for (auto pin_name : *error) {
for (const auto& pin_name : *error) {

ends.insert(open_sta_->getDbNetwork()->findPin(pinName.c_str()));
for (auto pin_name : *error) {
debugPrint(logger_, RMP, "remap", 1, "Unclocked pin: {}", pin_name);
if (!first && open_sta_->getDbNetwork()->findPin(pin_name.c_str())) {

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.

warning: redundant call to 'c_str' [readability-redundant-string-cstr]

Suggested change
if (!first && open_sta_->getDbNetwork()->findPin(pin_name.c_str())) {
if (!first && open_sta_->getDbNetwork()->findPin(pin_name)) {

for (auto pin_name : *error) {
debugPrint(logger_, RMP, "remap", 1, "Unclocked pin: {}", pin_name);
if (!first && open_sta_->getDbNetwork()->findPin(pin_name.c_str())) {
ends.insert(open_sta_->getDbNetwork()->findPin(pin_name.c_str()));

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.

warning: redundant call to 'c_str' [readability-redundant-string-cstr]

Suggested change
ends.insert(open_sta_->getDbNetwork()->findPin(pin_name.c_str()));
ends.insert(open_sta_->getDbNetwork()->findPin(pin_name));

@maliberty maliberty merged commit 3295560 into The-OpenROAD-Project:master Apr 19, 2026
16 of 17 checks passed
@maliberty maliberty deleted the rmp-tidy-naming branch April 19, 2026 23:36
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.

2 participants