Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-68210

idl generates suspicious std::move's for _dbName

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • None
    • Service Arch
    • ALL

    Description

      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.

      Attachments

        Activity

          People

            backlog-server-servicearch Backlog - Service Architecture
            milkie@mongodb.com Eric Milkie
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: