diff options
author | Noel Grandin <noel@peralex.com> | 2015-05-14 10:13:10 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-05-14 10:13:10 +0200 |
commit | 117c728593ee4596357cdf46741d326999209bb3 (patch) | |
tree | 2e62547fcacbec999a42c02e57d13435f4d8d921 /compilerplugins | |
parent | 8be85ad170d5e1fa23606de9be2ae255296eab52 (diff) |
loplugin: rendercontext, limit output for now
we are only currently interested in methods where the first parameter is
RenderContext
Change-Id: Ic505541c93a765e56e920415d3665b7aa4abb10b
Diffstat (limited to 'compilerplugins')
-rw-r--r-- | compilerplugins/clang/rendercontext.cxx | 7 |
1 files changed, 7 insertions, 0 deletions
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<CXXMethodDecl>(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; |