llvm / llvm/llvm-project

[clang] Support unnamed parameters in -Wdocumentation

Open
#172,470 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

clang:diagnostics clang:frontend enhancement
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Currently `-Wdocumentation` does not support unnamed parameters, since it requires that a name is present. For example:

```cpp
/// @param some unnamed parameter
/// @param y something
void f(int, int y) {}
```

It fails with:

```cpp
:1:12: warning: parameter 'some' not found in the function declaration [-Wdocumentation]
1 | /// @param some unnamed parameter
| ^~~~
```
https://godbolt.org/z/efqxdTTjb

It would be great if this use case could be supported in some way. In a relevant [Doxygen thread](https://github.com/doxygen/doxygen/issues/6926) they propose using an integer to identify the unnamed parameter:

```cpp
/// @param 1 some unnamed parameter
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported C++ example with Clang's -Wdocumentation and locate the implementation of that warning. Review how documented parameter names are matched, then determine how the proposed integer syntax should identify unnamed parameters. Done means the documented unnamed parameter is accepted without a false warning while invalid parameter references still produce diagnostics.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.