summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/vclwidgets.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-01-12 11:38:12 +0200
committerMichael Meeks <michael.meeks@collabora.com>2015-04-09 20:17:25 +0100
commit1f59e2cec3f4a22d612ca6cff06930c3d4bb77ca (patch)
tree22fb02505caea2c016d74b1a303cbcad1cb7614a /compilerplugins/clang/vclwidgets.cxx
parent9a6bf4be437102004a01ee5818e943f0e095eefe (diff)
vcl: window destructors calling dispose
Extend plugin to warn on any vcl::Window subclass that has a destructor and does not implement dispose. Apply this provision to the necessary classes in vcl/ Change-Id: I05189f8df02568131d59fc44fea904c87733c8c7
Diffstat (limited to 'compilerplugins/clang/vclwidgets.cxx')
-rw-r--r--compilerplugins/clang/vclwidgets.cxx13
1 files changed, 3 insertions, 10 deletions
diff --git a/compilerplugins/clang/vclwidgets.cxx b/compilerplugins/clang/vclwidgets.cxx
index 1f8e05b9692f..040c5ba2407d 100644
--- a/compilerplugins/clang/vclwidgets.cxx
+++ b/compilerplugins/clang/vclwidgets.cxx
@@ -82,18 +82,11 @@ bool VCLWidgets::VisitCXXRecordDecl(const CXXRecordDecl * recordDecl) {
}
if (!recordDecl->isCompleteDefinition())
return true;
- // check if this field is derived from Window
+ // check if this class is derived from Window
if (!isDerivedFromWindow(recordDecl)) {
return true;
}
- bool foundVclPtr = false;
- for(auto fieldDecl : recordDecl->fields()) {
- if (fieldDecl->getType().getAsString().find("VclPtr") != std::string::npos) {
- foundVclPtr = true;
- break;
- }
- }
- if (!foundVclPtr) {
+ if (!recordDecl->hasUserDeclaredDestructor()) {
return true;
}
bool foundDispose = false;
@@ -106,7 +99,7 @@ bool VCLWidgets::VisitCXXRecordDecl(const CXXRecordDecl * recordDecl) {
if (!foundDispose) {
report(
DiagnosticsEngine::Warning,
- "vcl::Window subclass with VclPtr members should declare a dispose() method.",
+ "vcl::Window subclass with destructor should declare a dispose() method.",
recordDecl->getLocation())
<< recordDecl->getSourceRange();
}