summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/vclwidgets.cxx13
1 files changed, 13 insertions, 0 deletions
diff --git a/compilerplugins/clang/vclwidgets.cxx b/compilerplugins/clang/vclwidgets.cxx
index 13217f93ddf6..8ec329353086 100644
--- a/compilerplugins/clang/vclwidgets.cxx
+++ b/compilerplugins/clang/vclwidgets.cxx
@@ -230,6 +230,7 @@ bool VCLWidgets::VisitVarDecl(const VarDecl * pVarDecl) {
&& !startsWith(pVarDecl->getType().getAsString(), "::std::multimap<sal_Int32, OTableWindow *>")
&& !startsWith(pVarDecl->getType().getAsString(), "::std::multimap<sal_Int32, class OTableWindow *>")
&& !startsWith(pVarDecl->getType().getAsString(), "::dbp::OMultiInstanceAutoRegistration< ::dbp::OUnoAutoPilot<")
+ && !startsWith(pVarDecl->getType().getAsString(), "SwSidebarWin_iterator")
&& containsWindowSubclass(pVarDecl->getType()))
{
report(
@@ -399,6 +400,9 @@ bool VCLWidgets::VisitFunctionDecl( const FunctionDecl* functionDecl )
}
}
// check dispose method to make sure we are actually disposing all of the VclPtr fields
+ /*
+ Now that we are in the debugging phase this is no longer useful, since we have to break this rule on
+ occassion to make the destruction process work cleanly.
if (pMethodDecl && pMethodDecl->isInstance() && pMethodDecl->getBody()
&& pMethodDecl->param_size()==0
&& pMethodDecl->getNameAsString() == "dispose"
@@ -458,6 +462,7 @@ bool VCLWidgets::VisitFunctionDecl( const FunctionDecl* functionDecl )
}
}
}
+ */
return true;
}
@@ -466,6 +471,14 @@ bool VCLWidgets::VisitCXXDeleteExpr(const CXXDeleteExpr *pCXXDeleteExpr)
if (ignoreLocation(pCXXDeleteExpr)) {
return true;
}
+ const CXXRecordDecl *pPointee = pCXXDeleteExpr->getArgument()->getType()->getPointeeCXXRecordDecl();
+ if (pPointee && isDerivedFromWindow(pPointee)) {
+ report(
+ DiagnosticsEngine::Warning,
+ "calling delete on instance of vcl::Window subclass, must rather call disposeAndClear()",
+ pCXXDeleteExpr->getLocStart())
+ << pCXXDeleteExpr->getSourceRange();
+ }
const ImplicitCastExpr* pImplicitCastExpr = dyn_cast<ImplicitCastExpr>(pCXXDeleteExpr->getArgument());
if (!pImplicitCastExpr) {
return true;