summaryrefslogtreecommitdiffstats
path: root/compilerplugins
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-01-24 13:19:04 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-01-24 13:19:39 +0200
commitfe2164949b38a7f73883dbdcb3271b94e5c81744 (patch)
treed3b8d4ccfd21debfd4c554149eca01fc0f1a7d72 /compilerplugins
parentloplugin: unnecessary destructor cppcanvas..filter (diff)
downloadcore-fe2164949b38a7f73883dbdcb3271b94e5c81744.tar.gz
core-fe2164949b38a7f73883dbdcb3271b94e5c81744.zip
teach unusedvariablecheck plugin about SfxPoolItem subclasses
which can all be treated as SAL_WARN_UNUSED The eehtml.cxx change probably fixes some CJK/CTL bug somewhere Change-Id: I6852129540f316075aee907971ac19418d71dd9a
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/unusedvariablecheck.cxx14
1 files changed, 9 insertions, 5 deletions
diff --git a/compilerplugins/clang/unusedvariablecheck.cxx b/compilerplugins/clang/unusedvariablecheck.cxx
index 8642032df12a..db6a45e1ae3f 100644
--- a/compilerplugins/clang/unusedvariablecheck.cxx
+++ b/compilerplugins/clang/unusedvariablecheck.cxx
@@ -49,7 +49,7 @@ void UnusedVariableCheck::run()
TraverseDecl( compiler.getASTContext().getTranslationUnitDecl());
}
-bool BaseCheckNotDialogSubclass(
+bool BaseCheckNotSomethingInterestingSubclass(
const CXXRecordDecl *BaseDefinition
#if CLANG_VERSION < 30800
, void *
@@ -59,21 +59,26 @@ bool BaseCheckNotDialogSubclass(
if (BaseDefinition && BaseDefinition->getQualifiedNameAsString().compare("Dialog") == 0) {
return false;
}
+ if (BaseDefinition && BaseDefinition->getQualifiedNameAsString().compare("SfxPoolItem") == 0) {
+ return false;
+ }
return true;
}
-bool isDerivedFromDialog(const CXXRecordDecl *decl) {
+bool isDerivedFromSomethingInteresting(const CXXRecordDecl *decl) {
if (!decl)
return false;
if (decl->getQualifiedNameAsString() == "Dialog")
return true;
+ if (decl->getQualifiedNameAsString() == "SfxPoolItem")
+ return true;
if (!decl->hasDefinition()) {
return false;
}
if (// not sure what hasAnyDependentBases() does,
// but it avoids classes we don't want, e.g. WeakAggComponentImplHelper1
!decl->hasAnyDependentBases() &&
- !compat::forallBases(*decl, BaseCheckNotDialogSubclass, nullptr, true)) {
+ !compat::forallBases(*decl, BaseCheckNotSomethingInterestingSubclass, nullptr, true)) {
return true;
}
return false;
@@ -114,8 +119,7 @@ bool UnusedVariableCheck::VisitVarDecl( const VarDecl* var )
|| n == "std::list" || n == "std::__debug::list"
|| n == "std::vector" || n == "std::__debug::vector" )
warn_unused = true;
- // check if this field is derived from Dialog
- if (!warn_unused && isDerivedFromDialog(type))
+ if (!warn_unused && isDerivedFromSomethingInteresting(type))
warn_unused = true;
}
if( warn_unused )