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

Michael Stahl (via logerrit) logerrit at kemper.freedesktop.org
Wed Sep 22 15:16:19 UTC 2021


 compilerplugins/clang/unnecessaryoverride.cxx |    3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 805cc60039fcce2ba356430cb90811a6e300a540
Author:     Michael Stahl <michael.stahl at allotropia.de>
AuthorDate: Wed Sep 22 15:33:53 2021 +0200
Commit:     Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Wed Sep 22 17:15:42 2021 +0200

    fix crash in compilerplugins/clang/unnecessaryoverride.cxx:328
    
    Somehow the compountStmt doesn't have anything in the body?
    
    Happens in CurlSession.cxx but not sure where.
    
    Change-Id: I69bd2e694e22c891f34242b8bee28012e793f0c6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122457
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>
    Tested-by: Jenkins

diff --git a/compilerplugins/clang/unnecessaryoverride.cxx b/compilerplugins/clang/unnecessaryoverride.cxx
index 7ce2627cc8fb..6523170105a2 100644
--- a/compilerplugins/clang/unnecessaryoverride.cxx
+++ b/compilerplugins/clang/unnecessaryoverride.cxx
@@ -325,6 +325,9 @@ bool UnnecessaryOverride::VisitCXXMethodDecl(const CXXMethodDecl* methodDecl)
             }
         */
         auto bodyIt = compoundStmt->body_begin();
+        if (bodyIt == compoundStmt->body_end()) {
+            return true;
+        }
         auto declStmt = dyn_cast<DeclStmt>(*bodyIt);
         if (!declStmt || !declStmt->isSingleDecl())
             return true;


More information about the Libreoffice-commits mailing list