[Libreoffice-commits] core.git: compilerplugins/clang

Stephan Bergmann sbergman at redhat.com
Tue Jun 6 07:24:21 UTC 2017


 compilerplugins/clang/vclwidgets.cxx |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit fee8afc22991dafa1c797a486df4722afb4cf17d
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jun 6 09:23:17 2017 +0200

    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

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",


More information about the Libreoffice-commits mailing list