This is an archive of the discontinued LLVM Phabricator instance.

[Analyzer] Replace `CXXSelfAssignmentBRVisitor` with `NoteTags`
ClosedPublic

Authored by baloghadamsoftware on May 27 2019, 4:03 AM.

Details

Summary

The cplusplus.SelfAssignment checker has a visitor that is added to every BugReport to mark the to branch of the self assignment operator with e.g. rhs == *this and rhs != *this. With the new NoteTag feature this visitor is not needed anymore. Instead the checker itself marks the two branches using the NoteTags.

Diff Detail

Repository
rC Clang

Event Timeline

baloghadamsoftware retitled this revision from Replace `CXXSelfAssignmentBRVisitor` with `NoteTags` to [Analyzer] Replace `CXXSelfAssignmentBRVisitor` with `NoteTags`.May 27 2019, 6:07 AM
NoQ accepted this revision.May 27 2019, 8:48 PM

Yay, cool!

lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
2388–2390

Looks like you almost invented note tags here :)

lib/StaticAnalyzer/Core/PathDiagnostic.cpp
736–738

Could you assert that this is indeed the case? Like, check that the "from" CFGBlock of the edge is the current CFG's ENTRY block? 'Cause it's not obvious that the beginning of the function is the correct source location in all cases where the CFGTerminator is not present (you should also be able to assert that the CFGTerminator is not present, but i don't think it's the right thing to assert, as we might add more kinds of statement-less CFGTerminators in the future).

This revision is now accepted and ready to land.May 27 2019, 8:48 PM
Szelethus accepted this revision.May 28 2019, 3:52 AM

I love this.

This revision was automatically updated to reflect the committed changes.