From 117c728593ee4596357cdf46741d326999209bb3 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 14 May 2015 10:13:10 +0200 Subject: loplugin: rendercontext, limit output for now we are only currently interested in methods where the first parameter is RenderContext Change-Id: Ic505541c93a765e56e920415d3665b7aa4abb10b --- compilerplugins/clang/rendercontext.cxx | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'compilerplugins') diff --git a/compilerplugins/clang/rendercontext.cxx b/compilerplugins/clang/rendercontext.cxx index bc34629613c2..24aaa081a99b 100644 --- a/compilerplugins/clang/rendercontext.cxx +++ b/compilerplugins/clang/rendercontext.cxx @@ -37,6 +37,7 @@ private: bool mbChecking = false; }; +// We use Traverse to set a flag so we can easily ignore certain method calls bool RenderContext::TraverseFunctionDecl(const FunctionDecl * pFunctionDecl) { if (ignoreLocation(pFunctionDecl)) { @@ -48,12 +49,18 @@ bool RenderContext::TraverseFunctionDecl(const FunctionDecl * pFunctionDecl) if ( pFunctionDecl != pFunctionDecl->getCanonicalDecl() ) { return true; } + // Ignore methods inside the OutputDevice class const CXXMethodDecl *pCXXMethodDecl = dyn_cast(pFunctionDecl); if (pCXXMethodDecl) { std::string aParentName = pCXXMethodDecl->getParent()->getQualifiedNameAsString(); if (aParentName == "OutputDevice") return true; } + // we are only currently interested in methods where the first parameter is RenderContext + string arg0 = pFunctionDecl->getParamDecl( 0 )->getType().getAsString(); + if ( arg0.find("RenderContext") != std::string::npos ) { + return true; + } mbChecking = true; TraverseStmt(pFunctionDecl->getBody()); mbChecking = false; -- cgit v1.2.3