This is an archive of the discontinued LLVM Phabricator instance.

[analyzer] Lambda capture non-POD type array
ClosedPublic

Authored by isuckatcs on Jul 17 2022, 10:14 AM.

Details

Summary

This patch allows us to analyze non-POD type arrays
captured by C++ lambdas.

To be able to capture the mentioned arrays, a new
ConstructionContext has been created, called
LambdaCaptureConstructionContext.

This patch has been extracted from, and depends on D129496.

Diff Detail

Event Timeline

isuckatcs created this revision.Jul 17 2022, 10:14 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 17 2022, 10:14 AM
isuckatcs requested review of this revision.Jul 17 2022, 10:14 AM
isuckatcs edited the summary of this revision. (Show Details)Jul 17 2022, 10:44 AM
NoQ accepted this revision.Jul 17 2022, 11:38 AM

Awesome, thanks! I was thinking like, lambdas in one patch, arrays in one patch, but this works too.

clang/test/Analysis/array-init-loop.cpp
164–168

Let's duplicate S3 to make sure both tests emit the warning. It isn't a problem that the warning is deduplicated, that's somewhat intentional. In real life most warnings are found on like 100 different paths each, we definitely need a deduplication mechanism. It's probably not ideal to deduplicate warnings by final node location when they're coming from different *analyses* but it isn't harmful either, users just get less warnings at a time, but eventually they'll see them all.

This revision is now accepted and ready to land.Jul 17 2022, 11:38 AM
isuckatcs updated this revision to Diff 445353.Jul 17 2022, 2:18 PM
isuckatcs marked an inline comment as done.

Addressed comments.

This revision was automatically updated to reflect the committed changes.