summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-08-31 11:23:26 +0200
committerStephan Bergmann <sbergman@redhat.com>2017-08-31 11:23:26 +0200
commit4082b5874adddedf8332fe977b6bb47b6949b302 (patch)
treeab2b3cdb2a08e0dbdfafa3234c2a1ef01a902c8a /compilerplugins
parent72cfd4d024aa9deb68010824a804f252e37b8388 (diff)
Restrict loplugin:constparams cast-to-void check
Change-Id: I3c4d4f99b423f46136a79f3b06c5f0e1492872f1
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/constparams.cxx8
1 files changed, 7 insertions, 1 deletions
diff --git a/compilerplugins/clang/constparams.cxx b/compilerplugins/clang/constparams.cxx
index 0aec1e3d82c2..9c2263c87453 100644
--- a/compilerplugins/clang/constparams.cxx
+++ b/compilerplugins/clang/constparams.cxx
@@ -425,7 +425,13 @@ bool ConstParams::checkIfCanBeConst(const Stmt* stmt, const ParmVarDecl* parmVar
return false;
}
if (loplugin::TypeCheck(t).Void()) {
- return false;
+ if (auto const sub = dyn_cast<DeclRefExpr>(
+ e->getSubExpr()->IgnoreParenImpCasts()))
+ {
+ if (sub->getDecl() == parmVarDecl) {
+ return false;
+ }
+ }
}
}
return checkIfCanBeConst(parent, parmVarDecl);