diff options
author | Noel Grandin <noel@peralex.com> | 2015-03-17 08:55:36 +0200 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-04-10 11:33:58 +0100 |
commit | e35bc27fdc648ee433c755312fa79263b49f1339 (patch) | |
tree | bb84b18a4958f85f3da393c68201fe0ead5eb0fd /compilerplugins | |
parent | 683cb12163803af2888b17ee4902e319c8bc49b4 (diff) |
vclwidget: make sure we have an explicit destructor
Change-Id: I50490ad8957e8069e72e855f0f5a3b694218fd6b
Diffstat (limited to 'compilerplugins')
-rw-r--r-- | compilerplugins/clang/vclwidgets.cxx | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/compilerplugins/clang/vclwidgets.cxx b/compilerplugins/clang/vclwidgets.cxx index 41fb2d2f5756..365451417ece 100644 --- a/compilerplugins/clang/vclwidgets.cxx +++ b/compilerplugins/clang/vclwidgets.cxx @@ -270,6 +270,13 @@ bool VCLWidgets::VisitFieldDecl(const FieldDecl * fieldDecl) { fieldDecl->getLocation()) << fieldDecl->getSourceRange(); } + if (!pParentRecordDecl->hasUserDeclaredDestructor()) { + report( + DiagnosticsEngine::Warning, + "vcl::Window subclass with a VclPtr field MUST have an explicit destructor.", + fieldDecl->getLocation()) + << fieldDecl->getSourceRange(); + } } return true; @@ -294,13 +301,6 @@ bool VCLWidgets::VisitParmVarDecl(ParmVarDecl const * pvDecl) { return true; } - if (!pvDecl->getType()->isReferenceType() && pvDecl->getType().getAsString().find("VclPtr") != std::string::npos) { - report( - DiagnosticsEngine::Warning, - "vcl::Window subclass passed as a VclPtr parameter, should be passed as a raw pointer.", - pvDecl->getCanonicalDecl()->getLocation()) - << pvDecl->getCanonicalDecl()->getSourceRange(); - } return true; } @@ -363,14 +363,6 @@ bool VCLWidgets::VisitFunctionDecl( const FunctionDecl* functionDecl ) && pMethodDecl->getParent()->getQualifiedNameAsString() == "vcl::Window") { return true; } - QualType t1 { compat::getReturnType(*functionDecl) }; - if (t1.getAsString().find("VclPtr") == 0) { - report( - DiagnosticsEngine::Warning, - "VclPtr declared as a return type from a method/function, should be passed as a raw pointer.", - functionDecl->getLocation()) - << functionDecl->getSourceRange(); - } if (functionDecl->hasBody() && pMethodDecl && isDerivedFromWindow(pMethodDecl->getParent())) { // check the last thing that the dispose() method does, is to call into the superclass dispose method if (pMethodDecl->getNameAsString() == "dispose") { |