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

Alexander Kornienko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 20 08:01:51 PDT 2018


alexfh added inline comments.


================
Comment at: clang-tidy/bugprone/ParentVirtualCallCheck.cpp:24
+
+static bool IsParentOf(const CXXRecordDecl &Parent,
+                       const CXXRecordDecl &ThisClass) {
----------------
http://llvm.org/docs/CodingStandards.html says: "Function names should be verb phrases (as they represent actions), and command-like function should be imperative. The name should be camel case, and start with a lower case letter (e.g. openFile() or isFoo())."


================
Comment at: clang-tidy/bugprone/ParentVirtualCallCheck.cpp:28
+    return true;
+  const auto ClassIter = llvm::find_if(ThisClass.bases(), [=](auto &Base) {
+    auto *BaseDecl = Base.getType()->getAsCXXRecordDecl();
----------------
Is `Parent` the only capture? I'd prefer it to be explicit instead of automatic.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D44295





More information about the cfe-commits mailing list