diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-08-07 14:40:39 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-08-07 15:27:38 +0200 |
commit | 959ace5861ca8dbb5fbec7a1954eeeb3b93ae4f3 (patch) | |
tree | 7213673c1ee87c1706416b5bf037fb14dc1580cc /compilerplugins/clang/constparams.cxx | |
parent | 22d5927000a32c54b0ba0355ca9c0999d3b00fb7 (diff) |
loplugin:constparams in sw part10
Change-Id: I7d708c3e6157d0b8690b433d3363d2c0745b2410
Reviewed-on: https://gerrit.libreoffice.org/40832
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.cxx | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/compilerplugins/clang/constparams.cxx b/compilerplugins/clang/constparams.cxx index 052e370c507d..a294e45d58c4 100644 --- a/compilerplugins/clang/constparams.cxx +++ b/compilerplugins/clang/constparams.cxx @@ -313,6 +313,7 @@ bool ConstParams::checkIfCanBeConst(const Stmt* stmt, const ParmVarDecl* parmVar return isPointerOrReferenceToConst(constructorDecl->getParamDecl(i)->getType()); } } + return false; // TODO ?? } else if (auto operatorCallExpr = dyn_cast<CXXOperatorCallExpr>(parent)) { const CXXMethodDecl* calleeMethodDecl = dyn_cast_or_null<CXXMethodDecl>(operatorCallExpr->getDirectCallee()); if (calleeMethodDecl) { @@ -343,6 +344,7 @@ bool ConstParams::checkIfCanBeConst(const Stmt* stmt, const ParmVarDecl* parmVar } } } + return false; // TODO ??? } else if (auto callExpr = dyn_cast<CallExpr>(parent)) { QualType functionType = callExpr->getCallee()->getType(); if (functionType->isFunctionPointerType()) { @@ -382,12 +384,13 @@ bool ConstParams::checkIfCanBeConst(const Stmt* stmt, const ParmVarDecl* parmVar } for (unsigned i = 0; i < callExpr->getNumArgs(); ++i) { if (i >= calleeFunctionDecl->getNumParams()) // can happen in template code - break; + return false; if (callExpr->getArg(i) == stmt) { return isPointerOrReferenceToConst(calleeFunctionDecl->getParamDecl(i)->getType()); } } } + return false; // TODO ???? } else if (isa<CXXReinterpretCastExpr>(parent)) { return false; } else if (isa<CXXConstCastExpr>(parent)) { @@ -459,15 +462,16 @@ bool ConstParams::checkIfCanBeConst(const Stmt* stmt, const ParmVarDecl* parmVar return true; } else if (isa<CXXPseudoDestructorExpr>(parent)) { return false; - } else { - parent->dump(); - parmVarDecl->dump(); - report( - DiagnosticsEngine::Warning, - "oh dear, what can the matter be?", - parent->getLocStart()) - << parent->getSourceRange(); + } else if (isa<CXXDependentScopeMemberExpr>(parent)) { + return false; } + parent->dump(); + parmVarDecl->dump(); + report( + DiagnosticsEngine::Warning, + "oh dear, what can the matter be?", + parent->getLocStart()) + << parent->getSourceRange(); return true; } |