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

Cong Liu via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 8 07:18:54 PST 2016


congliu added inline comments.

================
Comment at: clang-tidy/misc/VirtualNearMissCheck.cpp:232
@@ +231,3 @@
+    const auto *BaseRD = BaseSpec.getType()->getAsCXXRecordDecl();
+    if (BaseRD == nullptr)
+      return;
----------------
alexfh wrote:
> 1. When is this going to be nullptr?
> 2. Why do you return here instead of continuing to check other base classes?
1. Just to assure it's not nullptr. If the base specification contains a class type that was not declared anywhere, it would be nullptr. I found similar code here [[ https://cs.corp.google.com/#piper///depot/google3/third_party/llvm/llvm/tools/clang/tools/extra/clang-tidy/misc/NewDeleteOverloadsCheck.cpp&l=121 | NewDeleteOverloadsCheck.cpp, line 121]]
2. Sorry, it's a mistake, should be 'continue' not 'return'.

================
Comment at: test/clang-tidy/misc-virtual-near-miss.cpp:41
@@ +40,3 @@
+
+class Child : Father, Mother {
+public:
----------------
alexfh wrote:
> Is private inheritance intended here?
Yes, it's intended. This is for the case in line 57: although Father is a private base class of Child, since that function itself is in Child class, the conversion is accessible. 


http://reviews.llvm.org/D15823





More information about the cfe-commits mailing list