loplugin:badstatics

ScAddInListener has a member

  ScAddInDocs* pDocs; // documents where this is used

where ScAddInDocs is set<ScDocument*>, and ScDocument has a memmber

  VclPtr<SfxPrinter>    pPrinter;

so that's only a chain of (apparently non-owning) pointers.

Change-Id: I050218320eb2c588dcfaee80225f4e45a515ed32
Reviewed-on: https://gerrit.libreoffice.org/29613
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Stephan Bergmann 2016-10-08 23:49:29 +02:00
parent 2994586faa
commit 160478912a
2 changed files with 18 additions and 0 deletions

View file

@ -150,6 +150,8 @@ public:
// ScAddInAsync* keys if that set is not empty at exit
|| name == "g_aWindowList"
//vcl/unx/gtk/a11y/atkutil.cxx, asserted empty at exit
|| (loplugin::DeclCheck(pVarDecl).Var("aAllListeners")
.Class("ScAddInListener").GlobalNamespace()) // not owning
) // these variables appear unproblematic
{
return true;

View file

@ -78,6 +78,9 @@ public:
ContextCheck Operator(clang::OverloadedOperatorKind op) const;
template<std::size_t N> inline ContextCheck Var(char const (& id)[N])
const;
ContextCheck MemberFunction() const;
private:
@ -198,6 +201,19 @@ template<std::size_t N> ContextCheck DeclCheck::Function(char const (& id)[N])
return ContextCheck();
}
template<std::size_t N> ContextCheck DeclCheck::Var(char const (& id)[N])
const
{
auto f = llvm::dyn_cast_or_null<clang::VarDecl>(decl_);
if (f != nullptr) {
auto const i = f->getIdentifier();
if (i != nullptr && i->isStr(id)) {
return ContextCheck(f->getDeclContext());
}
}
return ContextCheck();
}
template<std::size_t N> ContextCheck ContextCheck::Namespace(
char const (& id)[N]) const
{