alexfh added a comment. > ... What about a configuration option to also report near misses when only a > qualifier is missing?
Might be a useful thing. We should first check if it makes sense to always ignore a qualifier. ================ Comment at: clang-tidy/misc/VirtualNearMissCheck.cpp:55 @@ -54,11 +54,3 @@ // Both types must be pointers or references to classes. - if (const auto *DerivedPT = DerivedReturnTy->getAs<PointerType>()) { - if (const auto *BasePT = BaseReturnTy->getAs<PointerType>()) { - DTy = DerivedPT->getPointeeType(); - BTy = BasePT->getPointeeType(); - } - } else if (const auto *DerivedRT = DerivedReturnTy->getAs<ReferenceType>()) { - if (const auto *BaseRT = BaseReturnTy->getAs<ReferenceType>()) { - DTy = DerivedRT->getPointeeType(); - BTy = BaseRT->getPointeeType(); - } + if ((BaseReturnTy->isPointerType() && DerivedReturnTy->isPointerType()) || + (BaseReturnTy->isReferenceType() && DerivedReturnTy->isReferenceType())) { ---------------- Interesting, didn't know about `Type::getPointeeType()`. I'd better return, if the condition is not met. The next `if` would be not needed then and the variable definitions above could be moved after this `if`. ================ Comment at: clang-tidy/misc/VirtualNearMissCheck.cpp:129 @@ -127,3 +128,3 @@ for (unsigned I = 0; I < NumParamA; I++) { - if (BaseMD->getParamDecl(I)->getType() != - DerivedMD->getParamDecl(I)->getType()) + if (getDecayedType(BaseMD->getParamDecl(I)->getType()) != + getDecayedType(DerivedMD->getParamDecl(I)->getType())) ---------------- We should check whether this creates any false positives. http://reviews.llvm.org/D16179 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits