[PATCH] D40813: [clang-tidy] Adding Fuchsia checker for virtual inheritance
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 5 07:54:23 PST 2017
aaron.ballman added inline comments.
================
Comment at: clang-tidy/fuchsia/FuchsiaTidyModule.cpp:28-29
"fuchsia-default-arguments");
+ CheckFactories.registerCheck<VirtualInheritanceCheck>(
+ "fuchsia-virtual-inheritance");
}
----------------
Formatting looks off here.
================
Comment at: clang-tidy/fuchsia/VirtualInheritanceCheck.cpp:21
+AST_MATCHER(CXXRecordDecl, hasVirtualBaseClass) {
+ return Node.hasDefinition() && (Node.getNumVBases() != 0);
+}
----------------
Elide spurious parens.
================
Comment at: clang-tidy/fuchsia/VirtualInheritanceCheck.cpp:44
+ else if (const auto *S = Result.Nodes.getNodeAs<CXXConstructExpr>("stmt"))
+ diag(S->getLocStart(), "constructing a class which inherits a virtual base "
+ "class is disallowed");
----------------
s/which/that
================
Comment at: docs/clang-tidy/checks/fuchsia-virtual-inheritance.rst:12
+
+ class B : public virtual A {} // warning
+
----------------
Missing a semicolon on the class declaration.
https://reviews.llvm.org/D40813
More information about the cfe-commits
mailing list