Page MenuHomePhabricator

[analyzer] VirtualCallChecker: Improve warning messages.

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


  • 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.Jul 23 2019, 6:22 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 23 2019, 6:22 PM
NoQ updated this revision to Diff 211397.Jul 23 2019, 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.Jul 23 2019, 6:31 PM
  • Hmm, also i'd rather say "method" than "function".
This revision is now accepted and ready to land.Jul 24 2019, 12:20 AM
NoQ updated this revision to Diff 211587.Jul 24 2019, 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.EditedJul 24 2019, 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.Aug 5 2019, 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.Aug 9 2019, 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.Aug 13 2019, 6:13 PM

Merged into D64274.