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
This commit is contained in:
Noel Grandin
2017-01-24 13:19:04 +02:00
parent 1d7c589d50
commit fe2164949b
14 changed files with 17 additions and 31 deletions

View File

@@ -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 )