/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * Based on LLVM/Clang. * * This file is distributed under the University of Illinois Open Source * License. See LICENSE.TXT for details. *
*/ #ifndef LO_CLANG_SHARED_PLUGINS
Check for cases where we have - two IDL interfaces A and B, - B extends A - we are converting a Reference<B> to a Reference<A> using UNO_QUERY
This makes the code simpler and cheaper, because UNO_QUERY can be surprisingly expensive if used a lot.
*/
namespace
{ class RtlRef : public loplugin::FilteringPlugin<RtlRef>
{ public: explicit RtlRef(loplugin::InstantiationData const& data)
: FilteringPlugin(data)
{
}
bool preRun() override
{
std::string fn(handler.getMainFileName());
loplugin::normalizeDotDotInFilePath(fn); if (fn == SRCDIR "/ucb/source/ucp/ext/ucpext_provider.cxx") returnfalse; if (fn == SRCDIR "/ucb/source/ucp/hierarchy/hierarchyprovider.cxx") returnfalse; if (fn == SRCDIR "/ucb/source/ucp/cmis/cmis_provider.cxx") returnfalse; if (fn == SRCDIR "/ucb/source/ucp/webdav-curl/webdavprovider.cxx") returnfalse; if (fn == SRCDIR "/ucb/source/ucp/webdav-curl/webdavresponseparser.cxx") returnfalse; if (fn == SRCDIR "/ucb/source/cacher/dynamicresultsetwrapper.cxx") returnfalse; if (fn == SRCDIR "/sax/source/fastparser/fastparser.cxx") returnfalse; if (fn == SRCDIR "/chart2/source/controller/main/ObjectHierarchy.cxx") returnfalse; if (fn == SRCDIR "/chart2/source/controller/main/ShapeController.cxx") returnfalse; if (fn == SRCDIR "/chart2/source/view/axes/VCartesianAxis.cxx") returnfalse; if (fn == SRCDIR "/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx") returnfalse; if (fn == SRCDIR "/chart2/source/view/main/DataTableView.cxx") returnfalse; if (fn == SRCDIR "/svx/source/form/datanavi.cxx") returnfalse; if (fn == SRCDIR "/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx") returnfalse; if (fn == SRCDIR "/sd/source/ui/annotations/annotationwindow.cxx") returnfalse; if (fn == SRCDIR "/sd/source/ui/unoidl/unopage.cxx") returnfalse; if (fn == SRCDIR "/xmlsecurity/source/helper/xsecsign.cxx") returnfalse; if (fn == SRCDIR "/xmlsecurity/source/helper/xsecctl.cxx") returnfalse; if (fn == SRCDIR "/unoxml/source/events/eventdispatcher.cxx") returnfalse; if (fn == SRCDIR "/unoxml/source/dom/element.cxx") returnfalse; returntrue;
}
void run() override
{ if (preRun())
{
TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
}
}
bool VisitVarDecl(const VarDecl*);
};
bool RtlRef::VisitVarDecl(const VarDecl* varDecl)
{ if (ignoreLocation(varDecl)) returntrue;
// don't bother processing anything in the Reference.h file. Makes my life easier when debugging this.
StringRef aFileName
= getFilenameOfLocation(compiler.getSourceManager().getSpellingLoc(varDecl->getBeginLoc())); if (loplugin::isSamePathname(aFileName, SRCDIR "/include/com/sun/star/uno/Reference.h")) returntrue; if (loplugin::isSamePathname(aFileName, SRCDIR "/include/com/sun/star/uno/Reference.hxx")) returntrue;
if (!loplugin::TypeCheck(varDecl->getType()).Class("Reference").Namespace("uno")) returntrue;
if (varDecl->isStaticLocal()) returntrue;
auto init = varDecl->getInit(); if (!init) returntrue;
init = init->IgnoreImpCasts();
auto memberCall = dyn_cast<CXXMemberCallExpr>(init); if (!memberCall) returntrue; if (memberCall->getNumArgs() > 1) returntrue;
auto innerExpr = memberCall->getImplicitObjectArgument()->IgnoreImpCasts(); if (!loplugin::TypeCheck(innerExpr->getType()).Class("Reference").Namespace("rtl")) returntrue;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.