[PATCH] D40813: [clang-tidy] Adding Fuchsia checker for virtual inheritance

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 6 08:28:49 PST 2017


aaron.ballman added inline comments.


================
Comment at: test/clang-tidy/fuchsia-virtual-inheritance.cpp:30
+class D : public B, public C {
+  // CHECK-MESSAGES: [[@LINE-1]]:1: warning: virtual inheritance is disallowed [fuchsia-virtual-inheritance]
+  // CHECK-NEXT: class C : public B, public C {
----------------
I don't think that this should be diagnosed -- it will be confusing to the user to see this claimed as virtual inheritance when there's no virtual inheritance at this level.


================
Comment at: test/clang-tidy/fuchsia-virtual-inheritance.cpp:34-36
+  // CHECK-MESSAGES: [[@LINE-1]]:28: warning: constructing a class that inherits a virtual base class is disallowed [fuchsia-virtual-inheritance]
+  // CHECK-NEXT:  D(int value) : A(value), B(), C() {}
+  // CHECK-MESSAGES: [[@LINE-3]]:33: warning: constructing a class that inherits a virtual base class is disallowed [fuchsia-virtual-inheritance]
----------------
I'm also not certain this should be diagnosed either. It's technically correct because it's calling the base class constructors here, but at the same time, it seems very low-value and likely to cause the user to do something really bad, like silence the warning by not calling the base class constructors.


https://reviews.llvm.org/D40813





More information about the cfe-commits mailing list