-
Notifications
You must be signed in to change notification settings - Fork 24
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
Conversation
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.
Mind running it again to see if these changes are stable?
ffe8121
to
83e930a
Compare
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 |
Also, Travis is not running anymore ? |
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.
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) |
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.
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; } |
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.
yeah, I think you'll need to #iffdef around this. Or move the noexcept for now.
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.
Solved. I also removed a couple of spurious semicolons.
Thanks, Ricardo! |
Avoid rvalue reference and move for compatibility (#61)
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).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