This is an archive of the discontinued LLVM Phabricator instance.

[analyzer] Remove pattern matching of lambda capture initializers
ClosedPublic

Authored by isuckatcs on Aug 16 2022, 12:51 AM.

Details

Summary

Prior to this patch we handled lambda captures based on their
initializer expression, which resulted in a pattern matching. With
C++17 copy elision the initializer expression can be anything,
and this approach proved to be fragile and a source of crashes.

Diff Detail

Event Timeline

isuckatcs created this revision.Aug 16 2022, 12:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 16 2022, 12:51 AM
isuckatcs requested review of this revision.Aug 16 2022, 12:51 AM
xazax.hun accepted this revision.Aug 16 2022, 8:52 AM
This revision is now accepted and ready to land.Aug 16 2022, 8:52 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 22 2022, 4:01 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
steakhal added inline comments.Oct 14 2022, 8:06 AM
clang/test/Analysis/lambdas.cpp
226

It should have said REACHABLE.
How does this pass? @isuckatcs

isuckatcs marked an inline comment as done.Oct 14 2022, 9:08 AM
isuckatcs added inline comments.
clang/test/Analysis/lambdas.cpp
226

Oh, it's a nice catch. Yes, it should say REACHABLE indeed.

Also it seems we didn't get a failing test case because this statement is not checked at all. It is inside a block that only runs if the standard is at least c++14, however the tests are only executed with an -std=c++11 flag.

I moved these test cases into their own test file in D135965.

isuckatcs marked an inline comment as done.Oct 14 2022, 9:08 AM