Skip to content

Commit 4c4ea24

Browse files
authored
[NFC][CLANG] Fix static analyzer bugs about unnecessary object copies with auto keyword (#85962)
Reported by Static Analyzer Tool: In clang::dataflow::Environment::initialize(): Using the auto keyword without an & causes the copy of an object of type LambdaCapture
1 parent 81fc43a commit 4c4ea24

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ void Environment::initialize() {
416416
assert(Parent != nullptr);
417417

418418
if (Parent->isLambda()) {
419-
for (auto Capture : Parent->captures()) {
419+
for (const auto &Capture : Parent->captures()) {
420420
if (Capture.capturesVariable()) {
421421
const auto *VarDecl = Capture.getCapturedVar();
422422
assert(VarDecl != nullptr);

0 commit comments

Comments
 (0)