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
[10.6.X][TRACK] fix for clang warnings #26167
Conversation
please test |
The code-checks are being triggered in jenkins. |
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-26167/8761
|
The tests are being triggered in jenkins. |
A new Pull Request was created by @smuzaffar (Malik Shahzad Muzaffar) for master. It involves the following packages: TrackPropagation/SteppingHelixPropagator @cmsbuild, @perrotta, @slava77 can you please review it and eventually sign? Thanks. cms-bot commands are listed here |
+1 The following merge commits were also included on top of IB + this PR after doing git cms-merge-topic: |
Comparison job queued. |
Comparison is ready Comparison Summary:
|
@@ -341,7 +341,7 @@ vector<Trajectory> TrackTransformerForCosmicMuons::transform(const reco::Track& | |||
return vector<Trajectory>(); | |||
} | |||
|
|||
return trajectoriesSM; | |||
return std::move(trajectoriesSM); |
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 recall that in similar other cases we switched to lvalue instead of introducing a move.
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.
The warning is
TrackingTools/TrackRefitter/src/TrackTransformerForCosmicMuons.cc:344:10: warning: local variable 'trajectoriesSM' will be copied despite being returned by name [-Wreturn-std-move]
I suppose this is because of it being an rvalue-reference vector<Trajectory> && trajectoriesSM = ...
on line 337 above.
It would likely be clearer to drop the rvalue reference, i.e. change to vector<Trajectory> trajectoriesSM = ...
, and keep returning the trajectoriesSM
by value (relying on NRVO).
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.
@makortel
thanks.
that's exactly what I meant, in a telegram style.
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.
@smuzaffar
please clarify if you are going to update this PR following the review comments.
Thank you.
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.
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 believe it really should be vector<Trajectory>
(i.e. value instead of const reference) for the NRVO to apply (or at least that's what a quick test on godbolt suggests).
By thr way, you we need line number 341? why not just return trajectoriesSM even if it is empty?
I was wondering the same and would just return trajectoriesSM
(probably some historical leftover).
The code-checks are being triggered in jenkins. |
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-26167/8829
|
The tests are being triggered in jenkins. |
Comparison job queued. |
Comparison is ready Comparison Summary:
|
This pull request is fully signed and it will be integrated in one of the next master IBs (tests are also fine). This pull request will now be reviewed by the release team before it's merged. @davidlange6, @slava77, @smuzaffar, @fabiocos (and backports should be raised in the release meeting by the corresponding L2) |
+1 |
PR description:
This fixes clang warnings for packages under Track* subsystem
PR validation:
Local clang build looks good
if this PR is a backport please specify the original PR:
Before submitting your pull requests, make sure you followed this checklist: