Skip to content
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

Apply Clang tidy modernize & performance #61

Merged
merged 7 commits into from
Apr 17, 2020

Conversation

ricrogz
Copy link
Collaborator

@ricrogz ricrogz commented Apr 12, 2020

Just what the title says. I did (each in one commit):

  • clang-tidy -fix -checks='modernize*,-modernize-use-trailing-return-type' *pp -- -std=c++11 (no manual editing).
  • The previous command pointed out that deleted constructors and assignments should be public, so I manually moved them into public: blocks.
  • clang-tidy -fix -checks='performance*,-modernize-use-trailing-return-type' *pp -- -std=c++11 (no manual editing).

clang-tidy was used from LLVM version 9.0.1. I disabled the "modernize-use-trailing-return-type" because it is annoying (changes function declarations to something like auto whatever() -> return type. I also find it slightly annoying that clang-tidy insists on adding #include <utility> to the headers, but decided not to remove it.

Checks passed on all three platforms (after bumping MacOS version): https://dev.azure.com/ricrogz/mymaeparser/_build/results?buildId=471

Copy link
Collaborator

@d-b-w d-b-w left a comment

Choose a reason for hiding this comment

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

Mind running it again to see if these changes are stable?

@ricrogz ricrogz force-pushed the clang-tidy_modernize branch from ffe8121 to 83e930a Compare April 14, 2020 00:41
@ricrogz
Copy link
Collaborator Author

ricrogz commented Apr 14, 2020

Updated. I reran clang-tidy, and it seems stable.

Also, I noticed the build failure in appveyor -- it looks like we use VS 12, and it doesn't understand noexcept. Do you think we should bump the VS version, @d-b-w ?

@ricrogz
Copy link
Collaborator Author

ricrogz commented Apr 14, 2020

Also, Travis is not running anymore ?

Copy link
Collaborator

@d-b-w d-b-w left a comment

Choose a reason for hiding this comment

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

Looks great after you resolve the noexcept business.

@@ -69,9 +70,9 @@ class EXPORT_MAEPARSER IndexedBlockMap : public IndexedBlockMapI
* Add an IndexedBlock to the map.
*/
void addIndexedBlock(const std::string& name,
std::shared_ptr<IndexedBlock> indexed_block)
std::shared_ptr<IndexedBlock>&& indexed_block)
Copy link
Collaborator

Choose a reason for hiding this comment

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

nice!

MaeParser.hpp Outdated
@@ -87,7 +88,7 @@ class EXPORT_MAEPARSER read_exception : public std::exception
format(line_number, column, msg);
}

virtual const char* what() const throw() { return m_msg; }
const char* what() const noexcept override { return m_msg; }
Copy link
Collaborator

Choose a reason for hiding this comment

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

yeah, I think you'll need to #iffdef around this. Or move the noexcept for now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Solved. I also removed a couple of spurious semicolons.

@d-b-w d-b-w merged commit d4909c2 into schrodinger:master Apr 17, 2020
@d-b-w
Copy link
Collaborator

d-b-w commented Apr 17, 2020

Thanks, Ricardo!

d-b-w added a commit that referenced this pull request Apr 24, 2020
Avoid rvalue reference and move for compatibility (#61)
@ricrogz ricrogz deleted the clang-tidy_modernize branch April 24, 2020 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants