[Libreoffice-commits] core.git: compilerplugins/clang

Noel Grandin noel at peralex.com
Thu May 14 01:13:56 PDT 2015


 compilerplugins/clang/rendercontext.cxx |    7 +++++++
 1 file changed, 7 insertions(+)

New commits:
commit 117c728593ee4596357cdf46741d326999209bb3
Author: Noel Grandin <noel at peralex.com>
Date:   Thu May 14 10:13:10 2015 +0200

    loplugin: rendercontext, limit output for now
    
    we are only currently interested in methods where the first parameter is
    RenderContext
    
    Change-Id: Ic505541c93a765e56e920415d3665b7aa4abb10b

diff --git a/compilerplugins/clang/rendercontext.cxx b/compilerplugins/clang/rendercontext.cxx
index bc34629..24aaa08 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;


More information about the Libreoffice-commits mailing list