Fix check for calls to OWeakObject::release

Change-Id: I90030dee12676eb356ebe2244358052cfcd725de
This commit is contained in:
Stephan Bergmann
2016-06-24 17:27:18 +02:00
parent 81db0773fe
commit e6daf6bfb0

View File

@@ -106,16 +106,23 @@ public:
{
// note: this is only sometimes a CXXMethodDecl
FunctionDecl const*const pCalled(pCallExpr->getDirectCallee());
if (pCalled->getName() == "release"
//this never works && pCalled == pOverridden
&& (pCalled->getParent() == pOverridden->getParent()
// allow this convenient shortcut
|| loplugin::TypeCheck(QualType(pMethodDecl->getParent()->getTypeForDecl(), 0)).Class("OWeakObject").Namespace("cppu")
|| loplugin::TypeCheck(QualType(pMethodDecl->getParent()->getTypeForDecl(), 0)).Class("OWeakAggObject").Namespace("cppu")))
if (pCalled->getName() == "release")
{
return true;
//this never works && pCalled == pOverridden
if (pCalled->getParent() == pOverridden->getParent())
{
return true;
}
// Allow this convenient shortcut:
auto td = dyn_cast<TypeDecl>(pCalled->getParent());
if (td != nullptr
&& (loplugin::TypeCheck(QualType(td->getTypeForDecl(), 0)).Class("OWeakObject").Namespace("cppu")
|| loplugin::TypeCheck(QualType(td->getTypeForDecl(), 0)).Class("OWeakAggObject").Namespace("cppu")))
{
return true;
}
}
if (pCalled->getName() == "relase_ChildImpl") // FIXME remove this lunacy
else if (pCalled->getName() == "relase_ChildImpl") // FIXME remove this lunacy
{
return true;
}