llvm / llvm/llvm-project

[clang-tidy] Extend modernize-use-designated-initializers to cover per-member initialization

Open
#165,210 3 comments 0 reactions 0 assignees View on GitHub
clang-tidy enhancement
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

~~~c++
struct S {
int a;
int b;
};

S f() {
S s;
s.a = 0;
s.b = 1;
//S s{ .a = 0, .b = 1 }; // fix-it
return s;
}
~~~
https://godbolt.org/z/rGvrzasYn

Contributor guide

Open the contributing guide

Research direction

Start by locating the clang-tidy modernize-use-designated-initializers check and its existing tests. Compare the shown per-member assignments with the check's current supported cases; done means it emits the requested designated-initializer fix-it for this pattern and tests cover it.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 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.