From fee8afc22991dafa1c797a486df4722afb4cf17d Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 6 Jun 2017 09:23:17 +0200 Subject: 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 --- compilerplugins/clang/vclwidgets.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'compilerplugins/clang/vclwidgets.cxx') 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(pCXXDestructorDecl->getBody()); + const CompoundStmt *pCompoundStatement = dyn_cast_or_null(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", -- cgit