summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/constparams.cxx9
1 files changed, 7 insertions, 2 deletions
diff --git a/compilerplugins/clang/constparams.cxx b/compilerplugins/clang/constparams.cxx
index 0a52ba1c77267..0aec1e3d82c2e 100644
--- a/compilerplugins/clang/constparams.cxx
+++ b/compilerplugins/clang/constparams.cxx
@@ -418,8 +418,13 @@ bool ConstParams::checkIfCanBeConst(const Stmt* stmt, const ParmVarDecl* parmVar
return false;
} else if (isa<CastExpr>(parent)) { // all other cast expression subtypes
if (auto e = dyn_cast<ExplicitCastExpr>(parent)) {
- loplugin::TypeCheck tc(e->getTypeAsWritten());
- if (tc.Pointer().NonConst() || tc.Void()) {
+ auto t = e->getTypeAsWritten();
+ if (t->isAnyPointerType()
+ && !t->getPointeeType().isConstQualified())
+ {
+ return false;
+ }
+ if (loplugin::TypeCheck(t).Void()) {
return false;
}
}