diff options
Diffstat (limited to 'compilerplugins/clang/unusedmethods.py')
-rwxr-xr-x | compilerplugins/clang/unusedmethods.py | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/compilerplugins/clang/unusedmethods.py b/compilerplugins/clang/unusedmethods.py index 8497719b8f77..a8b20cfe3b2c 100755 --- a/compilerplugins/clang/unusedmethods.py +++ b/compilerplugins/clang/unusedmethods.py @@ -33,7 +33,7 @@ def normalizeTypeParams( line ): # primary input loop # -------------------------------------------------------------------------------------------- -with io.open("workdir/loplugin.unusedmethods.log", "rb", buffering=1024*1024) as txt: +with io.open("workdir/loplugin.unusedmethods.log", "rb", buffering=16*1024*1024) as txt: for line in txt: tokens = line.strip().split("\t") if tokens[0] == "definition:": @@ -68,16 +68,10 @@ with io.open("workdir/loplugin.unusedmethods.log", "rb", buffering=1024*1024) as 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) def isOtherConstness( d, callSet ): method = d[0] + " " + d[1] @@ -162,6 +156,10 @@ for d in definitionSet: continue if d[0] == "basic_ostream<type-parameter-?-?, type-parameter-?-?> &" and d[1].startswith("operator<<(basic_ostream<type-parameter-?-?"): continue + # ignore lambdas + if " ::operator " in method or " ::__invoke(" in method or " ::operator()" in method: continue + # stuff generated by Qt + if "::tr(" in method or "::trUtf8(" in method: continue location = definitionToSourceLocationMap[d]; # whacky template stuff @@ -174,6 +172,10 @@ for d in definitionSet: if location.startswith("compilerplugins/clang/test"): continue # leave this alone for now if location.startswith("include/LibreOfficeKit"): continue + # template stuff + if location.startswith("include/vcl/vclptr.hxx"): continue + if location.startswith("include/oox/helper/refvector.hxx"): continue + if location.startswith("include/oox/drawingml/chart/modelbase.hxx"): continue unusedSet.add(d) # used by the "unused return types" analysis tmp1set.add((method, location)) @@ -232,11 +234,12 @@ for d in definitionSet: if location.startswith("include/tools/stream.hxx"): continue tmp2set.add((method, location)) +#Disable this for now, not really using it # print output, sorted by name and line number -with open("compilerplugins/clang/unusedmethods.unused-returns.results", "wt") as f: - for t in sort_set_by_natural_key(tmp2set): - f.write(t[1] + "\n") - f.write(" " + t[0] + "\n") +#with open("compilerplugins/clang/unusedmethods.unused-returns.results", "wt") as f: +# for t in sort_set_by_natural_key(tmp2set): +# f.write(t[1] + "\n") +# f.write(" " + t[0] + "\n") # -------------------------------------------------------------------------------------------- |