-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
[RFC] Test clang-tidy --checks performance-move-const-arg #29931
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,23 +14,22 @@ namespace { | |
namespace edm { | ||
ProductProvenance::ProductProvenance() : branchID_(), parentageID_() {} | ||
|
||
ProductProvenance::ProductProvenance(BranchID bid) : branchID_(std::move(bid)), parentageID_() {} | ||
ProductProvenance::ProductProvenance(BranchID bid) : branchID_(bid), parentageID_() {} | ||
|
||
ProductProvenance::ProductProvenance(BranchID bid, ParentageID edid) | ||
: branchID_(std::move(bid)), parentageID_(std::move(edid)) {} | ||
: branchID_(bid), parentageID_(std::move(edid)) {} | ||
|
||
ProductProvenance::ProductProvenance(BranchID bid, std::vector<BranchID> const& parents) | ||
: branchID_(std::move(bid)), parentageID_() { | ||
: branchID_(bid), parentageID_() { | ||
Parentage p; | ||
p.setParents(parents); | ||
parentageID_ = p.id(); | ||
ParentageRegistry::instance()->insertMapped(p); | ||
} | ||
|
||
ProductProvenance::ProductProvenance(BranchID bid, std::vector<BranchID>&& parents) | ||
: branchID_(std::move(bid)), parentageID_() { | ||
ProductProvenance::ProductProvenance(BranchID bid, std::vector<BranchID>&& parents) : branchID_(bid), parentageID_() { | ||
Parentage p; | ||
p.setParents(std::move(parents)); | ||
p.setParents(parents); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like we need a new setParents function in Parentage which passes the item by value. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I checked and |
||
parentageID_ = p.id(); | ||
ParentageRegistry::instance()->insertMapped(std::move(p)); | ||
} | ||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -1259,11 +1259,11 @@ namespace edm { | |||||||||||||||||||||||||||||||||||||
unsigned int streamIndex = 0; | ||||||||||||||||||||||||||||||||||||||
for (; streamIndex < preallocations_.numberOfStreams() - 1; ++streamIndex) { | ||||||||||||||||||||||||||||||||||||||
tbb::task::enqueue(*edm::make_functor_task(tbb::task::allocate_root(), [this, streamIndex, h = iHolder]() { | ||||||||||||||||||||||||||||||||||||||
handleNextEventForStreamAsync(std::move(h), streamIndex); | ||||||||||||||||||||||||||||||||||||||
handleNextEventForStreamAsync(h, streamIndex); | ||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one I don’t understand There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure either.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (just shooting out dark) Could it be that the check sees that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That would be 'real bad' if so. Hopefully not. |
||||||||||||||||||||||||||||||||||||||
})); | ||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||
tbb::task::spawn(*edm::make_functor_task(tbb::task::allocate_root(), [this, streamIndex, h = std::move(iHolder)]() { | ||||||||||||||||||||||||||||||||||||||
handleNextEventForStreamAsync(std::move(h), streamIndex); | ||||||||||||||||||||||||||||||||||||||
handleNextEventForStreamAsync(h, streamIndex); | ||||||||||||||||||||||||||||||||||||||
})); | ||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||
|
@@ -1734,7 +1734,7 @@ namespace edm { | |||||||||||||||||||||||||||||||||||||
})); | ||||||||||||||||||||||||||||||||||||||
WaitingTaskHolder afterProcessTask; | ||||||||||||||||||||||||||||||||||||||
if (subProcesses_.empty()) { | ||||||||||||||||||||||||||||||||||||||
afterProcessTask = std::move(finalizeEventTask); | ||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was intended to release the task and avoid its lifetime being too long There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
cmssw/FWCore/Concurrency/interface/WaitingTaskHolder.h Lines 32 to 49 in 4bbb63b
|
||||||||||||||||||||||||||||||||||||||
afterProcessTask = finalizeEventTask; | ||||||||||||||||||||||||||||||||||||||
} else { | ||||||||||||||||||||||||||||||||||||||
//Need to run SubProcesses after schedule has finished | ||||||||||||||||||||||||||||||||||||||
// with the event | ||||||||||||||||||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -98,7 +98,7 @@ namespace edm { | |
} | ||
edm::Timestamp const& lastTimestamp() const { return endTime_; } | ||
|
||
void setNextSyncValue(IOVSyncValue iValue) { nextSyncValue_ = std::move(iValue); } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is OK as the class has nothing useful to move. |
||
void setNextSyncValue(IOVSyncValue iValue) { nextSyncValue_ = iValue; } | ||
|
||
const IOVSyncValue nextSyncValue() const { return nextSyncValue_; } | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,9 +83,9 @@ namespace edm { | |
} | ||
|
||
InputTag::InputTag(InputTag&& other) | ||
: label_(std::move(other.label())), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Neither is what what intended. The move needs to be done using the member data not the member functions. |
||
instance_(std::move(other.instance())), | ||
process_(std::move(other.process())), | ||
: label_(other.label()), | ||
instance_(other.instance()), | ||
process_(other.process()), | ||
typeID_(), | ||
productRegistry_(nullptr), | ||
index_(ProductResolverIndexInvalid), | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,7 +93,7 @@ namespace cms::cuda { | |
ScopedContextAcquire::~ScopedContextAcquire() { | ||
holderHelper_.enqueueCallback(device(), stream()); | ||
if (contextState_) { | ||
contextState_->set(device(), std::move(streamPtr())); | ||
contextState_->set(device(), streamPtr()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll change the code such that the move can become meaningful. |
||
} | ||
} | ||
|
||
|
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 don’t think either of these is correct in this case. It looks like this was supposed to be
return std::unique_ptr<reco::Candidate>(std::move(cmp_));
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.
Agreed.
clang-tidy
doesn't try to correct buggy code, only to preserve the existing behaviour :-)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.
IIUC just
return std::move(cmp_);
could be enough.
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 had wondered if that would work or not.