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

Stephan Bergmann sbergman at redhat.com
Wed Aug 30 13:19:51 UTC 2017


 compilerplugins/clang/constparams.cxx |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

New commits:
commit 5d2e830a309dbc5186b2b6e35ecacf533ff7da0c
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Aug 30 15:14:19 2017 +0200

    Avoid loplugin:constparam when param is cast to void
    
    ...which typically indicates that the param just has to be of the given type for
    some reason
    
    Change-Id: Ide30f514c5a849ae897c31c1744ece9df712a9fc

diff --git a/compilerplugins/clang/constparams.cxx b/compilerplugins/clang/constparams.cxx
index 31c1bc29affa..2a1fc1ff8a2d 100644
--- a/compilerplugins/clang/constparams.cxx
+++ b/compilerplugins/clang/constparams.cxx
@@ -187,8 +187,6 @@ bool ConstParams::VisitFunctionDecl(const FunctionDecl * functionDecl)
             || name == "egiGraphicExport"
             || name == "etiGraphicExport"
             || name == "epsGraphicExport"
-            || name == "QueueCallbackFunction"
-                // apple_remote/source/HIDRemoteControlDevice.m
             )
                 return true;
     }
@@ -419,8 +417,8 @@ bool ConstParams::checkIfCanBeConst(const Stmt* stmt, const ParmVarDecl* parmVar
         return false;
     } else if (isa<CastExpr>(parent)) { // all other cast expression subtypes
         if (auto e = dyn_cast<ExplicitCastExpr>(parent)) {
-            if (loplugin::TypeCheck(e->getTypeAsWritten()).Pointer().NonConst())
-            {
+            loplugin::TypeCheck tc(e->getTypeAsWritten());
+            if (tc.Pointer().NonConst() || tc.Void()) {
                 return false;
             }
         }


More information about the Libreoffice-commits mailing list