[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
Thu Mar 15 12:29:35 PDT 2018


zinovy.nis added inline comments.


================
Comment at: test/clang-tidy/bugprone-parent-virtual-call.cpp:127
+// Just to instantiate DF<F>.
+int bar() { return (new DF<int>())->virt_1(); }
----------------
aaron.ballman wrote:
> What should happen in this case?
> ```
> struct Base {
>   virtual void f() {}
> };
> 
> struct Intermediary : Base {
> };
> 
> struct Derived : Intermediary {
>   void f() override {
>     Base::f(); // I would expect this not to diagnose
>   }
> };
> ```
> This would be a reasonable test case to add.
Please see `// Test virtual method is diagnosted although not overridden in parent.` section in the test file.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D44295





More information about the cfe-commits mailing list