From 5d2e830a309dbc5186b2b6e35ecacf533ff7da0c Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Wed, 30 Aug 2017 15:14:19 +0200 Subject: [PATCH] Avoid loplugin:constparam when param is cast to void ...which typically indicates that the param just has to be of the given type for some reason Change-Id: Ide30f514c5a849ae897c31c1744ece9df712a9fc --- compilerplugins/clang/constparams.cxx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/compilerplugins/clang/constparams.cxx b/compilerplugins/clang/constparams.cxx index 31c1bc29affa..2a1fc1ff8a2d 100644 --- a/compilerplugins/clang/constparams.cxx +++ b/compilerplugins/clang/constparams.cxx @@ -187,8 +187,6 @@ bool ConstParams::VisitFunctionDecl(const FunctionDecl * functionDecl) || name == "egiGraphicExport" || name == "etiGraphicExport" || name == "epsGraphicExport" - || name == "QueueCallbackFunction" - // apple_remote/source/HIDRemoteControlDevice.m ) return true; } @@ -419,8 +417,8 @@ bool ConstParams::checkIfCanBeConst(const Stmt* stmt, const ParmVarDecl* parmVar return false; } else if (isa(parent)) { // all other cast expression subtypes if (auto e = dyn_cast(parent)) { - if (loplugin::TypeCheck(e->getTypeAsWritten()).Pointer().NonConst()) - { + loplugin::TypeCheck tc(e->getTypeAsWritten()); + if (tc.Pointer().NonConst() || tc.Void()) { return false; } }