/* SPDX-FileCopyrightText: 2018 Sergio Martins SPDX-License-Identifier: LGPL-2.0-or-later */ #include "static-pmf.h" #include "QtUtils.h" #include "TypeUtils.h" #include #include #include #include using namespace clang; void StaticPmf::VisitDecl(clang::Decl *decl) { auto *vardecl = dyn_cast(decl); if (!vardecl || !vardecl->isStaticLocal()) { return; } const Type *t = clazy::unpealAuto(vardecl->getType()); if (!t) { return; } const auto *memberPointerType = dyn_cast(t); if (!memberPointerType || !memberPointerType->isMemberFunctionPointer()) { return; } auto *record = memberPointerType->getMostRecentCXXRecordDecl(); if (!clazy::isQObject(record, m_context->qtNamespace())) { return; } emitWarning(vardecl, "Static pointer to member has portability issues"); }