[SERVER-51361] Coverity analysis defect 100766: Missing move assignment operator Created: 05/Oct/20  Updated: 29/Oct/23  Resolved: 31/Dec/20

Status: Closed
Project: Core Server
Component/s: Performance
Affects Version/s: None
Fix Version/s: 4.9.0

Type: Improvement Priority: Major - P3
Reporter: Coverity Collector User Assignee: Sara Golemon
Resolution: Fixed Votes: 0
Labels: coverity, neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: Security 2021-01-11
Participants:

 Description   

Missing move assignment operator

This class does not have a user-written move assignment operator and its copy assignment operator is found to be applied to rvalue(s), which can be moved to possibly enhance program performance had the move assignment operator been in place. Class lacks a user-written move assignment operator
/src/mongo/db/auth/privilege.h:47: MISSING_MOVE_ASSIGNMENT 100766 Class "mongo::Privilege" may benefit from adding a move assignment operator. See other events which show the copy assignment operator being applied to rvalue(s), where a move assignment may be faster.



 Comments   
Comment by Githook User [ 30/Dec/20 ]

Author:

{'name': 'Sara Golemon', 'email': 'sara.golemon@mongodb.com', 'username': 'sgolemon'}

Message: SERVER-51361 Add move ctors and explicitly declare copy ctors
Branch: master
https://github.com/mongodb/mongo/commit/d580c25413e64ec333e55cd2c77282f2f2269df6

Comment by Spencer Jackson [ 05/Oct/20 ]

I believe Coverity is reporting a potential performance optimization, which would allow moving Privileges to move the underlying NamespaceString of its ResourcePattern, avoiding a copy.

Generated at Thu Feb 08 05:25:16 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.