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

Cong Liu via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 4 04:12:26 PST 2016


congliu marked 20 inline comments as done.

================
Comment at: clang-tidy/misc/VirtualNearMissCheck.cpp:59
@@ +58,3 @@
+bool VirtualNearMissCheck::isOverrideMethod(const CXXMethodDecl *MD){
+  return MD->size_overridden_methods() > 0 || MD->hasAttr<OverrideAttr>();
+}
----------------
alexfh wrote:
> Why is the `hasAttr<OverrideAttr>()` part needed? Do you have an example of code that results in `size_overridden_methods() == 0` and `hasAttr<OverrideAttr>() == true`?
I tried some cases, but haven't found an example for that case. 
I saw the same code in [[ https://cs.corp.google.com/#piper///depot/google3/third_party/llvm/llvm/tools/clang/include/clang/ASTMatchers/ASTMatchers.h&l=3500 | AST_MATCHER(CXXMethodDecl, isOverride) ]]. 
I'm not sure why there is a "hasAttr". 


http://reviews.llvm.org/D15823





More information about the cfe-commits mailing list