summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/vclwidgets.cxx22
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") {