llvm / llvm/llvm-project

[clang-tidy][request] Check that detects unqualified enumerator usage

Open
#196,087 12 comments 0 reactions 0 assignees View on GitHub
check-request clang-tidy
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

```c++
enum E { E0, E1 };
E f(E e) {
if (e == E0) {} // warn
return E::E1; // ok
}
```
Use cases: C++ code using C headers, preparation of switch to `enum class`, improve readability.

Contributor guide

Open the contributing guide

Research direction

Start by locating the clang-tidy check entry points and nearby check tests, then compare the supplied C++ example with existing diagnostics. The work is done when unqualified enumerator use such as E0 is diagnosed while qualified use such as E::E1 is accepted, with coverage for the stated C++ header and enum-class migration use cases.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.