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

TEMPLATE/REQUIRES macros hide function documentation, affect C++ tooling

    XMLWordPrintableJSON

Details

    • Service Arch
    • ALL

    Description

      The attached images show the hover-documention generated by YouCompleteMe in Vim and VSCode. Both are displaying the same data, which was produced by clangd for the Promise<T>::setWith function. The effect is much more dramatic in VSCode's rendering (screenshots attached).

      The TEMPLATE()/REQUIRES() macros have disassociated the documentation above the function's declaration. Clangd treats the function as if it were undocumented, showing only a dry report of the function's metadata.

      These macros do not provide a benefit in easy enable-if cases like this and should be replaced with an ordinary std::enable_if_t so they don't obscure declarations unnecessarily. After replacing TEMPLATE()/REQUIRES() with a C++ std::enable_if_t, we see a full page of documentation (screenshots attached for that condition for comparison).

      Attachments

        1. setwith_cxx.png
          setwith_cxx.png
          559 kB
        2. setwith_macros.png
          setwith_macros.png
          601 kB
        3. setwith_vscode_cxx.png
          setwith_vscode_cxx.png
          283 kB
        4. setwith_vscode_macros.png
          setwith_vscode_macros.png
          259 kB

        Activity

          People

            backlog-server-servicearch Backlog - Service Architecture
            billy.donahue@mongodb.com Billy Donahue
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated: