summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-03-10 09:07:06 +0200
committerMichael Meeks <michael.meeks@collabora.com>2015-04-10 10:55:36 +0100
commitd7a84ce8406096b455d81f50cd50ca2e877adc06 (patch)
treeb1dd2b5a4860cf2c9664e2ff3087b8dbb9db7576 /compilerplugins
parentc0a802b59e1edddeb0b621e15137f5058299efd7 (diff)
vclwidget: only call dispose() once
by using a new utility method in vcl::Window This means that we don't have to make all our dispose methods safe to call more than once. Change-Id: I2110c7de4a86c70fdc97dd8fd318c86b56865374
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/vclwidgets.cxx9
1 files changed, 7 insertions, 2 deletions
diff --git a/compilerplugins/clang/vclwidgets.cxx b/compilerplugins/clang/vclwidgets.cxx
index ba7da08dbc43..4189024851c6 100644
--- a/compilerplugins/clang/vclwidgets.cxx
+++ b/compilerplugins/clang/vclwidgets.cxx
@@ -162,13 +162,18 @@ bool VCLWidgets::VisitCXXDestructorDecl(const CXXDestructorDecl* pCXXDestructorD
if (pCompoundStatement && pCompoundStatement->size() == 1) {
const CXXMemberCallExpr *pCallExpr = dyn_cast<CXXMemberCallExpr>(*pCompoundStatement->body_begin());
if (pCallExpr) {
- ok = true;
+ if( const FunctionDecl* func = pCallExpr->getDirectCallee()) {
+ if( func->getNumParams() == 0 && func->getIdentifier() != NULL
+ && ( func->getName() == "disposeOnce" )) {
+ ok = true;
+ }
+ }
}
}
if (!ok) {
report(
DiagnosticsEngine::Warning,
- "vcl::Window subclass should have nothing in it's destructor but a call to dispose().",
+ "vcl::Window subclass should have nothing in it's destructor but a call to disposeOnce().",
pCXXDestructorDecl->getLocStart())
<< pCXXDestructorDecl->getSourceRange();
return true;