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

Add clang tidy rules to prevent const return by value and (in declarations) const pass by value

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.9.0
    • Component/s: Internal Code
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Sprint:
      Execution Team 2020-10-19

      Description

      There are parts of the codebase that suffer fromĀ const return by value and const pass by value.

      These can be caught by clang tidy, and we would like to add rules to do so. This and this are two clang tidy rules that could help us do so.

      However, there is one issue to watch out for:
      A const qualifier is often used on a pass-by-value param in the implementation file (here's an example). This is a readability enhancement. The reader of the function will now know that the function will not touch modify that param. This usage of the const qualifier shouldn't be flagged.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              benety.goh Benety Goh
              Reporter:
              vishnu.kaushik Vishnu Kaushik
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: