summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/vclwidgets.cxx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-06-06 09:23:17 +0200
committerStephan Bergmann <sbergman@redhat.com>2017-06-06 09:23:17 +0200
commitfee8afc22991dafa1c797a486df4722afb4cf17d (patch)
tree6aa12bb07664dc7a4a91b4ba9f5a02510e8be74a /compilerplugins/clang/vclwidgets.cxx
parent16ce815df3c782fecb56f3112169189d956a200e (diff)
getBody() can be null for a defaulted dtor
Not sure why that started to pop up only now, maybe something changed with recent Clang trunk. Change-Id: Ib6587b66afbf3e43d92c78432c0bfd61c74ba6c5
Diffstat (limited to 'compilerplugins/clang/vclwidgets.cxx')
-rw-r--r--compilerplugins/clang/vclwidgets.cxx6
1 files changed, 3 insertions, 3 deletions
diff --git a/compilerplugins/clang/vclwidgets.cxx b/compilerplugins/clang/vclwidgets.cxx
index c273b4aa8874..b493d1598bad 100644
--- a/compilerplugins/clang/vclwidgets.cxx
+++ b/compilerplugins/clang/vclwidgets.cxx
@@ -186,12 +186,12 @@ bool VCLWidgets::VisitCXXDestructorDecl(const CXXDestructorDecl* pCXXDestructorD
break;
}
}
- const CompoundStmt *pCompoundStatement = dyn_cast<CompoundStmt>(pCXXDestructorDecl->getBody());
+ const CompoundStmt *pCompoundStatement = dyn_cast_or_null<CompoundStmt>(pCXXDestructorDecl->getBody());
// having an empty body and no dispose() method is fine
- if (!bFoundVclPtrField && !bFoundDispose && pCompoundStatement && pCompoundStatement->size() == 0) {
+ if (!bFoundVclPtrField && !bFoundDispose && (!pCompoundStatement || pCompoundStatement->size() == 0)) {
return true;
}
- if (bFoundVclPtrField && pCompoundStatement && pCompoundStatement->size() == 0) {
+ if (bFoundVclPtrField && (!pCompoundStatement || pCompoundStatement->size() == 0)) {
report(
DiagnosticsEngine::Warning,
BASE_REF_COUNTED_CLASS " subclass with VclPtr field must call disposeOnce() from its destructor",