File tree Expand file tree Collapse file tree 1 file changed +1
-5
lines changed Expand file tree Collapse file tree 1 file changed +1
-5
lines changed Original file line number Diff line number Diff line change @@ -63,32 +63,28 @@ void AvoidDefaultLambdaCaptureCheck::check(
63
63
" lambda default captures are discouraged; "
64
64
" prefer to capture specific variables explicitly" );
65
65
66
- // Build the complete replacement capture list
67
66
std::vector<std::string> AllCaptures;
68
67
69
- // Add explicit captures first (preserve their order)
70
68
for (const auto &Capture : Lambda->explicit_captures ()) {
71
69
if (const auto CaptureText = generateImplicitCaptureText (Capture)) {
72
70
AllCaptures.push_back (CaptureText.value ());
73
71
}
74
72
}
75
73
76
- // Add implicit captures (convert to explicit)
77
74
for (const auto &Capture : Lambda->implicit_captures ()) {
78
75
if (const auto CaptureText = generateImplicitCaptureText (Capture)) {
79
76
AllCaptures.push_back (CaptureText.value ());
80
77
}
81
78
}
82
79
83
- // Build the final capture list
80
+ // Replace with new capture list
84
81
std::string ReplacementText;
85
82
if (AllCaptures.empty ()) {
86
83
ReplacementText = " []" ;
87
84
} else {
88
85
ReplacementText = " [" + llvm::join (AllCaptures, " , " ) + " ]" ;
89
86
}
90
87
91
- // Replace the entire capture list with the explicit version
92
88
SourceRange IntroducerRange = Lambda->getIntroducerRange ();
93
89
if (IntroducerRange.isValid ()) {
94
90
Diag << FixItHint::CreateReplacement (IntroducerRange, ReplacementText);
You can’t perform that action at this time.
0 commit comments