llvm / llvm/llvm-project

[clang-tidy] readability-identifier-naming does not enforce `MemberCase` when `PrivateMemberSuffix` is enabled.

Open
#198,476 5 comments 0 reactions 0 assignees View on GitHub
clang-tidy
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Example:

```cpp
class Foo
{
private:
int Something_;
};
```

Running clang-tidy with:
```
-checks=readability-identifier-naming --config="{CheckOptions: {readability-identifier-naming.MemberCase: lower_case, readability-identifier-naming.PrivateMemberSuffix: '_'}}"
```
Gives no warnings even though the member should have `lower_case`. https://godbolt.org/z/PPr35KqjW

Removing the `PrivateMemberSuffix` option makes the warning show up as intended:

https://godbolt.org/z/Tdz5fT9fj

But these are orthogonal options so they should have no effect on each other.

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with the clang-tidy readability-identifier-naming check and the two CheckOptions shown, then compare it with the configuration without PrivateMemberSuffix. Trace how MemberCase and PrivateMemberSuffix are evaluated; done means the example emits a lower_case naming warning while both orthogonal options remain enabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.