congliu marked 2 inline comments as done. ================ Comment at: clang-tidy/misc/VirtualNearMissCheck.cpp:79 @@ +78,3 @@ + if (BaseReturnType->isReferenceType() && DerivedReturnType->isReferenceType()){ + BaseReturnType = BaseReturnType.getNonReferenceType(); + DerivedReturnType = DerivedReturnType.getNonReferenceType(); ---------------- alexfh wrote: > You can call `.getNonReferenceType()` unconditionally to make the code > shorter. The condition is necessary, for the same reason I explained in the comment for line 85.
================ Comment at: clang-tidy/misc/VirtualNearMissCheck.cpp:85 @@ +84,3 @@ + }else { + return false; + } ---------------- alexfh wrote: > What if both return types are not references and are not pointers? Why do you > return `false` in this case? This is to deal with an special case of C++ override. Usually the return type of the override and overriden should be the same. The exception is that the return type ban be a reference (or pointer) to the class themselves. For example, class Base{ virtual Base* func(); }; class Derived : Base{ virtual Derived* func(); }; In this case, the Derived::func() does override Base::func(), even though the return type are not the same. So if the return types are not the same (line 72 assured that), and are not both references (or pointers), we can rule out the possibility of override, and therefore return false. http://reviews.llvm.org/D15823 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits