loplugin:useuniqueptr fix check for DELETEZ inside compound stmt
Change-Id: Id748b8b0c9cfe8c288dfafb5d0c2a83a8de2c91c Reviewed-on: https://gerrit.libreoffice.org/57871 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
parent
fbd757349e
commit
4089e1d9f6
@ -154,11 +154,16 @@ class Foo12 {
|
|||||||
class Foo13 {
|
class Foo13 {
|
||||||
int * m_pbar1; // expected-note {{member is here [loplugin:useuniqueptr]}}
|
int * m_pbar1; // expected-note {{member is here [loplugin:useuniqueptr]}}
|
||||||
int * m_pbar2; // expected-note {{member is here [loplugin:useuniqueptr]}}
|
int * m_pbar2; // expected-note {{member is here [loplugin:useuniqueptr]}}
|
||||||
|
int * m_pbar3; // expected-note {{member is here [loplugin:useuniqueptr]}}
|
||||||
~Foo13()
|
~Foo13()
|
||||||
{
|
{
|
||||||
if (m_pbar1)
|
if (m_pbar1)
|
||||||
DELETEZ(m_pbar1); // expected-error {{unconditional call to delete on a member, should be using std::unique_ptr [loplugin:useuniqueptr]}}
|
DELETEZ(m_pbar1); // expected-error {{unconditional call to delete on a member, should be using std::unique_ptr [loplugin:useuniqueptr]}}
|
||||||
DELETEZ(m_pbar2); // expected-error {{unconditional call to delete on a member, should be using std::unique_ptr [loplugin:useuniqueptr]}}
|
DELETEZ(m_pbar2); // expected-error {{unconditional call to delete on a member, should be using std::unique_ptr [loplugin:useuniqueptr]}}
|
||||||
|
if (m_pbar3)
|
||||||
|
{
|
||||||
|
DELETEZ(m_pbar3); // expected-error {{unconditional call to delete on a member, should be using std::unique_ptr [loplugin:useuniqueptr]}}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// check for unconditional inner compound statements
|
// check for unconditional inner compound statements
|
||||||
|
@ -228,7 +228,7 @@ void UseUniquePtr::CheckForSimpleDelete(const CXXMethodDecl* methodDecl, const C
|
|||||||
auto ifDeleteExpr = dyn_cast<CXXDeleteExpr>(*j);
|
auto ifDeleteExpr = dyn_cast<CXXDeleteExpr>(*j);
|
||||||
if (ifDeleteExpr)
|
if (ifDeleteExpr)
|
||||||
CheckDeleteExpr(methodDecl, ifDeleteExpr);
|
CheckDeleteExpr(methodDecl, ifDeleteExpr);
|
||||||
ParenExpr const * parenExpr = dyn_cast<ParenExpr>(*i);
|
ParenExpr const * parenExpr = dyn_cast<ParenExpr>(*j);
|
||||||
if (parenExpr)
|
if (parenExpr)
|
||||||
CheckParenExpr(methodDecl, parenExpr);
|
CheckParenExpr(methodDecl, parenExpr);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user