[PATCH] D44295: [clang-tidy] Detects and fixes calls to grand-...parent virtual methods instead of calls to parent's virtual methods

Zinovy Nis via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 9 10:02:53 PST 2018

zinovy.nis added inline comments.

Comment at: clang-tidy/bugprone/ParentVirtualCallCheck.cpp:152
+        Member->getQualifierLoc().getSourceRange(),
+        GetNameAsString(*(Parents.front())) + "::");
+  }
malcolm.parsons wrote:
> What does this do for templated parent classes?
Please see my last test case in updated revision.

Comment at: docs/clang-tidy/checks/bugprone-parent-virtual-call.rst:6
+FIXME: Describe what patterns does the check detect and why. Give examples.
malcolm.parsons wrote:
Oops. Thanks!

Comment at: test/clang-tidy/bugprone-parent-virtual-call.cpp:102
+  // CHECK-MESSAGES: :[[@LINE-1]]:34: warning: 'AA::virt_1' is a grand-parent's method, not parent's. Did you mean 'BB_1' or 'BB_2'? [bugprone-parent-virtual-call]
+  // No fix available due to multiple choise of parent class.
malcolm.parsons wrote:
> typo: choice

  rCTE Clang Tools Extra


More information about the cfe-commits mailing list