summaryrefslogtreecommitdiff
path: root/compilerplugins/clang
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-07-26 14:11:32 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-07-27 08:03:26 +0200
commit8ce64dbb3d7875c00963ae257d53f2b7b58fc4ad (patch)
tree070a1a2f11d553511c24423290829713c1f2fba6 /compilerplugins/clang
parent781a30e938c58c4d91d08f8c6f9e3f8745682d72 (diff)
loplugin:constparams in svx
and fix a bug in the plugin itself when calling operator's like the one on std::function<> Change-Id: I1617607107eeff06785c1841f69e13ad2926218e Reviewed-on: https://gerrit.libreoffice.org/40446 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'compilerplugins/clang')
-rw-r--r--compilerplugins/clang/constparams.cxx10
1 files changed, 7 insertions, 3 deletions
diff --git a/compilerplugins/clang/constparams.cxx b/compilerplugins/clang/constparams.cxx
index 15936c9e593d..9f43e90fdc02 100644
--- a/compilerplugins/clang/constparams.cxx
+++ b/compilerplugins/clang/constparams.cxx
@@ -111,6 +111,9 @@ bool ConstParams::VisitFunctionDecl(FunctionDecl * functionDecl)
|| name == "my_if_errors"
|| name == "my_eval_defined"
|| name == "my_eval_variable"
+ || name == "ImpGetEscDir"
+ || name == "ImpGetPercent"
+ || name == "ImpGetAlign"
// #ifdef win32
|| name == "convert_slashes"
// UNO component entry points
@@ -268,9 +271,10 @@ bool ConstParams::checkIfCanBeConst(const Stmt* stmt, const ParmVarDecl* parmVar
if (operatorCallExpr->getArg(0) == stmt) {
return calleeMethodDecl->isConst();
}
- if (operatorCallExpr->getArg(1) == stmt) {
- return isPointerOrReferenceToConst(calleeMethodDecl->getParamDecl(0)->getType());
- }
+ for (unsigned i = 1; i < operatorCallExpr->getNumArgs(); ++i)
+ if (operatorCallExpr->getArg(i) == stmt) {
+ return isPointerOrReferenceToConst(calleeMethodDecl->getParamDecl(i - 1)->getType());
+ }
} else {
const Expr* callee = operatorCallExpr->getCallee()->IgnoreParenImpCasts();
const DeclRefExpr* dr = dyn_cast<DeclRefExpr>(callee);