This is an archive of the discontinued LLVM Phabricator instance.

[analyzer][draft] Explain where references are coming from in the use after move check
AcceptedPublic

Authored by xazax.hun on Sep 1 2022, 1:47 PM.

Details

Reviewers
NoQ
martong

Diff Detail

Event Timeline

xazax.hun created this revision.Sep 1 2022, 1:47 PM
Herald added a project: Restricted Project. · View Herald Transcript
xazax.hun requested review of this revision.Sep 1 2022, 1:47 PM
martong accepted this revision.Sep 5 2022, 5:00 AM

LGTM, with nits.

clang/lib/StaticAnalyzer/Checkers/MoveChecker.cpp
434

This could be const couldn't it? Plus we should express that this is a pointer, I think.

435
clang/test/Analysis/use-after-move.cpp
799–800

I suppose these changes stem from D131262 coupled with trackExpressionValue, right? ...

1019–1025

... And this is the only new relevant test case.

This revision is now accepted and ready to land.Sep 5 2022, 5:00 AM
NoQ added inline comments.Sep 7 2022, 7:46 PM
clang/test/Analysis/use-after-move.cpp
1019–1025

Hmmm. This example actually looks alright without an explanation of ref or a. Once the object is moved, it doesn't matter what its backstory was. Did you mean std::move(ref)? That would warrant a note about ref (but still, not necessarily about the initializer of a).