summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/constparams.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-07-20 10:08:03 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-07-20 12:01:08 +0200
commit6d829ae4f218b5d751cfc366f071fc6160c0787c (patch)
tree0a013183aa423d51c004756ae843961c3803aacd /compilerplugins/clang/constparams.cxx
parentf1481007077723f7676f517db8df1363d070d459 (diff)
loplugin:constparams in basic
Change-Id: Idf55f63f2d56be4997a8cdc6afc5690eacac9a60 Reviewed-on: https://gerrit.libreoffice.org/40214 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'compilerplugins/clang/constparams.cxx')
-rw-r--r--compilerplugins/clang/constparams.cxx4
1 files changed, 4 insertions, 0 deletions
diff --git a/compilerplugins/clang/constparams.cxx b/compilerplugins/clang/constparams.cxx
index 0bee8fbc134c..d2d779c4d1c4 100644
--- a/compilerplugins/clang/constparams.cxx
+++ b/compilerplugins/clang/constparams.cxx
@@ -107,6 +107,7 @@ bool ConstParams::VisitFunctionDecl(FunctionDecl * functionDecl)
|| name == "memory_write"
|| name == "file_write"
|| name == "SalMainPipeExchangeSignal_impl"
+ || name.startswith("SbRtl_")
// UNO component entry points
|| name.endswith("component_getFactory")
// in Scheduler::, wants to loop until a reference to a bool becomes true
@@ -197,6 +198,9 @@ bool ConstParams::VisitDeclRefExpr( const DeclRefExpr* declRefExpr )
if (interestingSet.find(parmVarDecl) == interestingSet.end()) {
return true;
}
+ // no need to check again if we have already eliminated this one
+ if (cannotBeConstSet.find(parmVarDecl) != cannotBeConstSet.end())
+ return true;
if (!checkIfCanBeConst(declRefExpr, parmVarDecl))
cannotBeConstSet.insert(parmVarDecl);