congliu added a comment.

> - Ignore qualifiers.


I don't think we should ignore qualifiers. Please see my inline comment for 
line 52 of the test file.


================
Comment at: clang-tidy/misc/VirtualNearMissCheck.cpp:240
@@ -247,2 +239,3 @@
         unsigned EditDistance =
-            BaseMD->getName().edit_distance(DerivedMD->getName());
+            StringRef(BaseMD->getNameAsString())
+                .edit_distance(DerivedMD->getNameAsString());
----------------
NamedDecl::getName() directly returns a StringRef. Why using 
"getNameAsString()"? 

================
Comment at: test/clang-tidy/misc-virtual-near-miss.cpp:52
@@ -49,2 +51,3 @@
 
-  int methoe(int x); // Should not warn: method is not const.
+  int methoe(int x);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: method 'Child::methoe' has 
{{.*}} 'Mother::method'
----------------
If a function in derived class has a same name but different cv-qualifiers as a 
function in base class, they are not regarded as overriding. For example, 

```
class Mother{ 
  virtual int method(int argc) const;
};
class Child : Mother{
  int method(int x);
};
```
In this case, Child::method does not overrides Mother::method, but hides it. So 
I think we should not warn for "methoe", because even if the programmer changes 
"methoe" to "method", it's not an overriding. 


http://reviews.llvm.org/D16179



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to