Page MenuHomePhabricator

[analyzer] VirtualCallChecker: Improve warning messages.
AbandonedPublic

Authored by NoQ on Tue, Jul 23, 6:22 PM.

Details

Summary
  • Mention the name of the virtual function. This should help when the warning appears in a complicated expression and it's unclear what part of the expression it is about.
  • Calling a pure virtual function always sinks the analysis, even if the checker is not in pure-only mode.
  • Refactor/modernize the code a bit.

Diff Detail

Event Timeline

NoQ created this revision.Tue, Jul 23, 6:22 PM
Herald added a project: Restricted Project. · View Herald TranscriptTue, Jul 23, 6:22 PM
NoQ updated this revision to Diff 211397.Tue, Jul 23, 6:27 PM
  • Print only class name::method name instead of a fully qualified name, because fully qualified names may get pretty long.
  • Remove more dead code.
NoQ updated this revision to Diff 211399.Tue, Jul 23, 6:31 PM
  • Hmm, also i'd rather say "method" than "function".
This revision is now accepted and ready to land.Wed, Jul 24, 12:20 AM
NoQ updated this revision to Diff 211587.Wed, Jul 24, 12:43 PM

One more thing: explain the consequences of the bug, so that it was obvious what the problem is.

Charusso accepted this revision.EditedWed, Jul 24, 12:55 PM

When I started programming I read that the programming is British English, but LLVM project has more 'behavior' than 'behaviour', so as being democratic it should be fine. Thanks!

a_sidorin accepted this revision.Mon, Aug 5, 2:50 PM

Hi Artem,
The patch looks good to me. I prefer a fully qualified name, however, but it is a matter of taste.

NoQ updated this revision to Diff 214441.Fri, Aug 9, 1:30 PM
  • Fix checker names for consumers that display them (eg., clang-tidy). Add a test.
  • Change bug descriptions: "Call to virtual function during construction or destruction" -> "Pure virtual method call" | "Unexpected loss of virtual dispatch"
  • Remove the suggestion to explicitly qualify the call. It is incorrect for nested stack frames, as it may affect the behavior when the same function is called from elsewhere.
  • Make the category reusable, fix capitalization to stay similar to other bug categories.
NoQ abandoned this revision.Tue, Aug 13, 6:13 PM

Merged into D64274.