summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-11-06 09:04:58 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-11-06 10:47:15 +0100
commit9e087d4a3011aa98de6151aeda9cbb40b1fd21ef (patch)
tree0d6219941df2857fd63e1d9f913214af6804fb2e /compilerplugins
parentd746e6f7cbc9e7225b965c1b506a0050dd386e53 (diff)
loplugin:unusedvariablecheck tweak to find more stuff
but leave the tweak commented out, since it generates false positives Change-Id: Iaf3f92414d2618f8780561f98765e33e282afe0c Reviewed-on: https://gerrit.libreoffice.org/82121 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/unusedvariablecheck.cxx16
1 files changed, 15 insertions, 1 deletions
diff --git a/compilerplugins/clang/unusedvariablecheck.cxx b/compilerplugins/clang/unusedvariablecheck.cxx
index 25af5438b465..07e5fe0b2ace 100644
--- a/compilerplugins/clang/unusedvariablecheck.cxx
+++ b/compilerplugins/clang/unusedvariablecheck.cxx
@@ -53,7 +53,21 @@ bool UnusedVariableCheck::VisitVarDecl( const VarDecl* var )
return true;
if( var->isDefinedOutsideFunctionOrMethod())
return true;
- if( loplugin::isExtraWarnUnusedType(var->getType()))
+
+ auto type = var->getType();
+ bool check = loplugin::isExtraWarnUnusedType(type);
+
+ // this chunk of logic generates false+, which is why we don't leave it on
+/*
+ if (!check && type->isRecordType())
+ {
+ auto recordDecl
+ = dyn_cast_or_null<CXXRecordDecl>(type->getAs<RecordType>()->getDecl());
+ if (recordDecl && recordDecl->hasDefinition() && recordDecl->hasTrivialDestructor())
+ check = true;
+ }
+*/
+ if(check)
{
if( const ParmVarDecl* param = dyn_cast< ParmVarDecl >( var ))
{