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

Noel Grandin noel at peralex.com
Thu Feb 25 09:59:17 UTC 2016


 compilerplugins/clang/unuseddefaultparams.cxx |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 9c6b6c6c074a8597502e899a22aa7cb1c3f712ce
Author: Noel Grandin <noel at peralex.com>
Date:   Thu Feb 25 11:57:47 2016 +0200

    turn unuseddefaultparams plugin off by default
    
    add fix the method override logic
    
    Change-Id: Ia75bc70aa1b8d26a65a4082956dc88a0fd17be9e

diff --git a/compilerplugins/clang/unuseddefaultparams.cxx b/compilerplugins/clang/unuseddefaultparams.cxx
index 1e33fea..548720f 100644
--- a/compilerplugins/clang/unuseddefaultparams.cxx
+++ b/compilerplugins/clang/unuseddefaultparams.cxx
@@ -130,10 +130,6 @@ bool UnusedDefaultParams::VisitCallExpr(CallExpr * callExpr) {
         return true;
     }
     const FunctionDecl* functionDecl = callExpr->getDirectCallee()->getCanonicalDecl();
-    auto n = functionDecl->getNumParams();
-    if (n == 0 || !functionDecl->getParamDecl(n - 1)->hasDefaultArg()) {
-        return true;
-    }
     // method overrides don't always specify the same default params (althogh they probably should)
     // so we need to work our way up to the root method
     while (isa<CXXMethodDecl>(functionDecl)) {
@@ -142,6 +138,10 @@ bool UnusedDefaultParams::VisitCallExpr(CallExpr * callExpr) {
             break;
         functionDecl = *methodDecl->begin_overridden_methods();
     }
+    auto n = functionDecl->getNumParams();
+    if (n == 0 || !functionDecl->getParamDecl(n - 1)->hasDefaultArg()) {
+        return true;
+    }
     assert(callExpr->getNumArgs() <= n); // can be < in template code
     for (unsigned i = callExpr->getNumArgs(); i != 0;) {
         --i;
@@ -208,7 +208,7 @@ bool UnusedDefaultParams::VisitFunctionDecl( const FunctionDecl* functionDecl )
     return true;
 }
 
-loplugin::Plugin::Registration< UnusedDefaultParams > X("unuseddefaultparams", true);
+loplugin::Plugin::Registration< UnusedDefaultParams > X("unuseddefaultparams", false);
 
 }
 


More information about the Libreoffice-commits mailing list