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

Noel Grandin noel.grandin at collabora.co.uk
Thu Jul 12 10:41:37 UTC 2018


 compilerplugins/clang/countusersofdefaultparams.py |    2 ++
 compilerplugins/clang/finalclasses.py              |    3 +++
 compilerplugins/clang/mergeclasses.cxx             |    2 +-
 compilerplugins/clang/mergeclasses.py              |    3 +++
 compilerplugins/clang/singlevalfields.py           |    2 ++
 compilerplugins/clang/virtualdown.py               |    4 +++-
 6 files changed, 14 insertions(+), 2 deletions(-)

New commits:
commit 85cf4d25a3df3da86840c69bc035d58212a9672c
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu Jul 12 11:14:13 2018 +0200

    loplugin:mergeclasses fix ignoring some stuff
    
    Seems that calling getCanonicalDecl here results in us sometimes picking
    up forward-decl's, which hides stuff
    
    Also make the python processing code spit out a message if I manage to
    mess up the log files
    
    Change-Id: I08bf50eb26cf463c126507b51535b0a0fc9f7ecf

diff --git a/compilerplugins/clang/countusersofdefaultparams.py b/compilerplugins/clang/countusersofdefaultparams.py
index 06c38b9e4807..d7ac6a62d8f2 100755
--- a/compilerplugins/clang/countusersofdefaultparams.py
+++ b/compilerplugins/clang/countusersofdefaultparams.py
@@ -35,6 +35,8 @@ with io.open("workdir/loplugin.countusersofdefaultparams.log", "rb", buffering=1
             if not funcInfo in callDict:
                 callDict[funcInfo] = set()
             callDict[funcInfo].add(sourceLocationOfCall)
+        else:
+            print( "unknown line: " + line)
 
 # Invert the definitionToSourceLocationMap.
 sourceLocationToDefinitionMap = {}
diff --git a/compilerplugins/clang/finalclasses.py b/compilerplugins/clang/finalclasses.py
index d2d4f695b8a1..f6c15ca2c87d 100755
--- a/compilerplugins/clang/finalclasses.py
+++ b/compilerplugins/clang/finalclasses.py
@@ -29,6 +29,9 @@ with open("workdir/loplugin.finalclasses.log") as txt:
                 parent = parent[7:]
             inheritFromSet.add(parent);
 
+        else:
+            print( "unknown line: " + line)
+
 tmpset = set()
 for clazz in sorted(definitionSet - inheritFromSet):
     file = definitionToFileDict[clazz]
diff --git a/compilerplugins/clang/mergeclasses.cxx b/compilerplugins/clang/mergeclasses.cxx
index ca6cdeac74be..6035e7c275dc 100644
--- a/compilerplugins/clang/mergeclasses.cxx
+++ b/compilerplugins/clang/mergeclasses.cxx
@@ -148,7 +148,7 @@ bool MergeClasses::VisitCXXRecordDecl(const CXXRecordDecl* decl)
     }
     if (decl->isThisDeclarationADefinition())
     {
-        SourceLocation spellingLocation = compiler.getSourceManager().getSpellingLoc(decl->getCanonicalDecl()->getLocStart());
+        SourceLocation spellingLocation = compiler.getSourceManager().getSpellingLoc(decl->getLocStart());
         std::string filename = compiler.getSourceManager().getFilename(spellingLocation);
         filename = filename.substr(strlen(SRCDIR));
         std::string s = decl->getQualifiedNameAsString();
diff --git a/compilerplugins/clang/mergeclasses.py b/compilerplugins/clang/mergeclasses.py
index e070ee49e81a..902acf8b9aa9 100755
--- a/compilerplugins/clang/mergeclasses.py
+++ b/compilerplugins/clang/mergeclasses.py
@@ -56,6 +56,7 @@ def extractModuleName(clazz):
 with open("compilerplugins/clang/mergeclasses.results", "wt") as f:
     # loop over defined, but not instantiated classes
     for clazz in sorted(definitionSet - instantiatedSet):
+        if clazz == "svl::IUndoManager": print parentChildDict[clazz]
         # ignore classes without any children, and classes with more than one child
         if (clazz not in parentChildDict) or (len(parentChildDict[clazz]) != 1):
             continue
@@ -68,6 +69,8 @@ with open("compilerplugins/clang/mergeclasses.results", "wt") as f:
         if ("mutex" in clazz) or ("Mutex" in clazz):
             continue
         otherclazz = next(iter(parentChildDict[clazz]))
+        if clazz == "svl::IUndoManager": print extractModuleName(clazz)
+        if clazz == "svl::IUndoManager": print extractModuleName(otherclazz)
         # exclude combinations that span modules because we often use those to make cross-module dependencies more manageable.
         if extractModuleName(clazz) != extractModuleName(otherclazz):
             continue
diff --git a/compilerplugins/clang/singlevalfields.py b/compilerplugins/clang/singlevalfields.py
index ae1025cb6e3d..b842929011b1 100755
--- a/compilerplugins/clang/singlevalfields.py
+++ b/compilerplugins/clang/singlevalfields.py
@@ -34,6 +34,8 @@ with io.open("workdir/loplugin.singlevalfields.log", "rb", buffering=1024*1024)
             if not fieldInfo in fieldAssignDict:
                 fieldAssignDict[fieldInfo] = set()
             fieldAssignDict[fieldInfo].add(assignValue)
+        else:
+            print( "unknown line: " + line)
 
 tmp1list = list()
 for fieldInfo, assignValues in fieldAssignDict.iteritems():
diff --git a/compilerplugins/clang/virtualdown.py b/compilerplugins/clang/virtualdown.py
index a1d5c6e80d9f..9c1346ff2831 100755
--- a/compilerplugins/clang/virtualdown.py
+++ b/compilerplugins/clang/virtualdown.py
@@ -20,7 +20,9 @@ with io.open("workdir/loplugin.virtualdown.log", "rb", buffering=1024*1024) as t
         elif tokens[0] == "call:":
             fullMethodName = tokens[1]
             callSet.add(fullMethodName)
-            
+        else:
+            print( "unknown line: " + line)
+
 unnecessaryVirtualSet = set()
 
 for clazz in (definitionSet - callSet):


More information about the Libreoffice-commits mailing list