[PATCH] D15823: Support virtual-near-miss check.

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 13 06:12:34 PST 2016

alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.

Looks good with one nit. I'll update the comment myself and commit the patch for you.

Thank you for the contribution!

Comment at: clang-tidy/misc/VirtualNearMissCheck.cpp:60
@@ +59,3 @@
+    }
+  } else if (const auto *DerivedRT = DerivedReturnTy->getAs<ReferenceType>()) {
+    if (const auto *BaseRT = BaseReturnTy->getAs<ReferenceType>()) {
Answering my own question: I guess, it may be useful for methods of template classes and for template methods, where the template declaration doesn't make it clear whether the method is overridden or not. However the author may want the compiler to ensure the instantiation actually overrides something.

Comment at: clang-tidy/misc/VirtualNearMissCheck.h:39
@@ +38,3 @@
+  ///
+  /// It should look up the PossibleMap or update it.
+  bool isPossibleToBeOverridden(const CXXMethodDecl *BaseMD);
nit: `It should look up ...` sounds like a requirement, however, you exactly know what the implementation does, so `It looks up ... or updates ...` is better. Maybe even `Results are memoized in PossibleMap.`

Same below.


More information about the cfe-commits mailing list