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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Nov 21 10:15:53 UTC 2018


 compilerplugins/clang/constfields.py               |   12 ------------
 compilerplugins/clang/countusersofdefaultparams.py |    7 -------
 compilerplugins/clang/inlinefields.py              |   12 ------------
 compilerplugins/clang/methodcycles.py              |   12 ------------
 compilerplugins/clang/unusedenumconstants.py       |   12 ------------
 compilerplugins/clang/unusedfields.py              |   12 ------------
 6 files changed, 67 deletions(-)

New commits:
commit 0acbfd466aa8070c99c1d93f499fa5abb6b0d86a
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Nov 21 12:13:05 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Nov 21 12:14:35 2018 +0200

    loplugin, remove unnecessary filtering in post-processing
    
    removing things that point to the same source location is only really
    necessary for the method-based analyses, the other's dont need it, and
    it can hide stuff we are interested in
    
    Change-Id: Ib5c3b4c2ed4011c158a199fcd08096285976b831

diff --git a/compilerplugins/clang/constfields.py b/compilerplugins/clang/constfields.py
index 9ce5e2747fda..980363f78eb9 100755
--- a/compilerplugins/clang/constfields.py
+++ b/compilerplugins/clang/constfields.py
@@ -42,18 +42,6 @@ with io.open("workdir/loplugin.constfields.log", "rb", buffering=1024*1024) as t
         else:
             print( "unknown line: " + line)
 
-# Invert the definitionToSourceLocationMap
-# If we see more than one method at the same sourceLocation, it's being autogenerated as part of a template
-# and we should just ignore it
-sourceLocationToDefinitionMap = {}
-for k, v in definitionToSourceLocationMap.iteritems():
-    sourceLocationToDefinitionMap[v] = sourceLocationToDefinitionMap.get(v, [])
-    sourceLocationToDefinitionMap[v].append(k)
-for k, definitions in sourceLocationToDefinitionMap.iteritems():
-    if len(definitions) > 1:
-        for d in definitions:
-            definitionSet.remove(d)
-
 # Calculate can-be-const-field set
 canBeConstFieldSet = set()
 for d in definitionSet:
diff --git a/compilerplugins/clang/countusersofdefaultparams.py b/compilerplugins/clang/countusersofdefaultparams.py
index d7ac6a62d8f2..eabb7d5ef30e 100755
--- a/compilerplugins/clang/countusersofdefaultparams.py
+++ b/compilerplugins/clang/countusersofdefaultparams.py
@@ -38,13 +38,6 @@ with io.open("workdir/loplugin.countusersofdefaultparams.log", "rb", buffering=1
         else:
             print( "unknown line: " + line)
 
-# Invert the definitionToSourceLocationMap.
-sourceLocationToDefinitionMap = {}
-for k, v in definitionToSourceLocationMap.iteritems():
-    sourceLocationToDefinitionMap[v] = sourceLocationToDefinitionMap.get(v, [])
-    sourceLocationToDefinitionMap[v].append(k)
-
-    
 tmp1list = list()
 for k,v in callDict.iteritems():
     if len(v) >= 1:
diff --git a/compilerplugins/clang/inlinefields.py b/compilerplugins/clang/inlinefields.py
index 80dc6a39621c..4b8211c86a62 100755
--- a/compilerplugins/clang/inlinefields.py
+++ b/compilerplugins/clang/inlinefields.py
@@ -45,18 +45,6 @@ with io.open("workdir/loplugin.inlinefields.log", "rb", buffering=1024*1024) as
         else:
             print( "unknown line: " + line)
 
-# Invert the definitionToSourceLocationMap
-# If we see more than one method at the same sourceLocation, it's being autogenerated as part of a template
-# and we should just ignore it
-sourceLocationToDefinitionMap = {}
-for k, v in definitionToSourceLocationMap.iteritems():
-    sourceLocationToDefinitionMap[v] = sourceLocationToDefinitionMap.get(v, [])
-    sourceLocationToDefinitionMap[v].append(k)
-for k, definitions in sourceLocationToDefinitionMap.iteritems():
-    if len(definitions) > 1:
-        for d in definitions:
-            definitionSet.remove(d)
-
 tmp1list = list()
 for d in definitionSet:
 # TODO see comment in InlineFields::VisitCXXDeleteExpr
diff --git a/compilerplugins/clang/methodcycles.py b/compilerplugins/clang/methodcycles.py
index 2f7bef09918f..9093cebc420c 100755
--- a/compilerplugins/clang/methodcycles.py
+++ b/compilerplugins/clang/methodcycles.py
@@ -56,18 +56,6 @@ with io.open("workdir/loplugin.methodcycles.log2", "rb", buffering=1024*1024) as
         cnt = cnt + 1
         #if cnt > 100000: break
 
-# Invert the definitionToSourceLocationMap.
-# If we see more than one method at the same sourceLocation, it's being autogenerated as part of a template
-# and we should just ignore it.
-#sourceLocationToDefinitionMap = {}
-#for k, v in definitionToSourceLocationMap.iteritems():
-#    sourceLocationToDefinitionMap[v] = sourceLocationToDefinitionMap.get(v, [])
-#    sourceLocationToDefinitionMap[v].append(k)
-#for k, definitions in sourceLocationToDefinitionMap.iteritems():
-#    if len(definitions) > 1:
-#        for d in definitions:
-#            definitionSet.remove(d)
-
 # sort the results using a "natural order" so sequences like [item1,item2,item10] sort nicely
 def natural_sort_key(s, _nsre=re.compile('([0-9]+)')):
     return [int(text) if text.isdigit() else text.lower()
diff --git a/compilerplugins/clang/unusedenumconstants.py b/compilerplugins/clang/unusedenumconstants.py
index c498f38c76d7..2a2251776a17 100755
--- a/compilerplugins/clang/unusedenumconstants.py
+++ b/compilerplugins/clang/unusedenumconstants.py
@@ -43,18 +43,6 @@ with io.open("workdir/loplugin.unusedenumconstants.log", "rb", buffering=1024*10
         else:
             print( "unknown line: " + line)
 
-# Invert the definitionToSourceLocationMap
-# If we see more than one method at the same sourceLocation, it's being autogenerated as part of a template
-# and we should just ignore
-sourceLocationToDefinitionMap = {}
-for k, v in definitionToSourceLocationMap.iteritems():
-    sourceLocationToDefinitionMap[v] = sourceLocationToDefinitionMap.get(v, [])
-    sourceLocationToDefinitionMap[v].append(k)
-for k, definitions in sourceLocationToDefinitionMap.iteritems():
-    if len(definitions) > 1:
-        for d in definitions:
-            definitionSet.remove(d)
-
 def startswith_one_of( srcLoc, fileSet ):
     for f in fileSet:
         if srcLoc.startswith(f):
diff --git a/compilerplugins/clang/unusedfields.py b/compilerplugins/clang/unusedfields.py
index dcb37a72017f..5ec0388bc0d2 100755
--- a/compilerplugins/clang/unusedfields.py
+++ b/compilerplugins/clang/unusedfields.py
@@ -58,18 +58,6 @@ with io.open("workdir/loplugin.unusedfields.log", "rb", buffering=1024*1024) as
         else:
             print( "unknown line: " + line)
 
-# Invert the definitionToSourceLocationMap
-# If we see more than one method at the same sourceLocation, it's being autogenerated as part of a template
-# and we should just ignore it
-sourceLocationToDefinitionMap = {}
-for k, v in definitionToSourceLocationMap.iteritems():
-    sourceLocationToDefinitionMap[v] = sourceLocationToDefinitionMap.get(v, [])
-    sourceLocationToDefinitionMap[v].append(k)
-for k, definitions in sourceLocationToDefinitionMap.iteritems():
-    if len(definitions) > 1:
-        for d in definitions:
-            definitionSet.remove(d)
-
 # Calculate untouched
 untouchedSet = set()
 untouchedSetD = set()


More information about the Libreoffice-commits mailing list