Fix a number of clang-tidy detected defects#22416
Conversation
Test Results 21 files 21 suites 3d 11h 4m 24s ⏱️ For more details on these failures, see this check. Results for commit 0aaf399. ♻️ This comment has been updated with latest results. |
With commit c5ee8b5 (enable unique_ptr support for nested STL collections), the method TClassEdit::GetUniquePtrType() became obsolete.
dpiparo
left a comment
There was a problem hiding this comment.
Thanks for these changes! Would it be useful to expand this kind of campaigns to other portions of the codebase, e.g. roofit or RDF, or explore other checks?
| { | ||
| return 0 == name.compare(0, 17, "std::__pair_base<") || 0 == name.compare(0, 12, "__pair_base<"); | ||
| } | ||
| inline std::string GetUniquePtrType(std::string_view name) |
There was a problem hiding this comment.
TClassEdit is a public interface and thus this 'could' be used outside of ROOT. Should we deprecated it instead of removing it?
|
Thanks for this, it's great!
Yes. Maybe even sth like: |
| RException(const RException &other) noexcept : std::runtime_error(other) | ||
| { | ||
| try { | ||
| fError = other.fError; |
There was a problem hiding this comment.
This could throw because of std::string and std::vector in RError? Maybe add a comment, and a mention in the commit message why exceptions should be nothrow copy constructible.
Also, I think implementing the copy constructor deletes the move constructor and assignment operators, so they must be implemented explicitly (rule of five).
| @@ -147,9 +147,9 @@ public: | |||
| static RError ForwardError(RResultBase &&result, RError::RLocation &&sourceLocation) | |||
There was a problem hiding this comment.
Should these methods also take const ref?
| { | ||
| // Avoid frequent reallocations as we move up the call stack | ||
| fStackTrace.reserve(32); | ||
| AddFrame(std::move(sourceLocation)); |
There was a problem hiding this comment.
Hm, is this moving a const ref? 🤔
Maybe. I think the next step would be a regular clang-tidy check for RNTuple as part of the CI. Looking into it. |
A test run of clang-tidy on the RNTuple code with the following checks