idl generates suspicious std::move's for _dbName

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Server Programmability
    • ALL
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      In buildscripts/idl/idl/generator.py, we generate special initializer code for _dbName members such that it uses an already moved-from nss variable.  For examples:

      ListIndexes::ListIndexes(const NamespaceStringOrUUID nssOrUUID)
          : _nssOrUUID(std::move(nssOrUUID)),
            _dbName(nssOrUUID.uuid() ? nssOrUUID.dbname() : nssOrUUID.nss().get().db().toString()),
            _hasDbName(true) {}
      
      ShardsvrDropCollectionIfUUIDNotMatchingRequest::ShardsvrDropCollectionIfUUIDNotMatchingRequest(
          const NamespaceString nss,
          mongo::UUID expectedCollectionUUID)
          : _nss(std::move(nss)),
            _expectedCollectionUUID(std::move(expectedCollectionUUID)),
            _dbName(nss.db().toString()),
            _hasExpectedCollectionUUID(true),
            _hasDbName(true) {}
      

      While this code may technically work okay, it would be nicer to initialize _dbName with _nss instead of nss so that static analysis checkers aren't flagging it.

            Assignee:
            Unassigned
            Reporter:
            Eric Milkie
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: