summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/unusedfields.py
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-09-18 09:43:18 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-09-18 09:45:15 +0200
commit1ff0f0ba29cc14c265fd74c49710a079e67ee943 (patch)
tree1d888efb9fc5b88d021216a297dd4d251e5c0932 /compilerplugins/clang/unusedfields.py
parentafeff9102c2935139de4efd40fd2286dce396706 (diff)
improve unusedfields loplugin
(*) IsPassedByNonConst was completely wrong, not even sure why it worked before. (*) treat a field passed to operator>>= as being written to, but not read Change-Id: Id3a5f2f35222986fe5edba3f5a58215a1815d401
Diffstat (limited to 'compilerplugins/clang/unusedfields.py')
-rwxr-xr-xcompilerplugins/clang/unusedfields.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/compilerplugins/clang/unusedfields.py b/compilerplugins/clang/unusedfields.py
index 09779eb71571..3d3683c0c704 100755
--- a/compilerplugins/clang/unusedfields.py
+++ b/compilerplugins/clang/unusedfields.py
@@ -69,6 +69,7 @@ for k, definitions in sourceLocationToDefinitionMap.iteritems():
# Calculate untouched or untouched-except-for-in-constructor
untouchedSet = set()
+untouchedSetD = set()
for d in definitionSet:
if d in touchedFromOutsideSet or d in touchedFromInsideSet:
continue
@@ -100,11 +101,12 @@ for d in definitionSet:
if "::sfx2::sidebar::ControllerItem" in fieldType:
continue
untouchedSet.add((d[0] + " " + d[1] + " " + fieldType, srcLoc))
+ untouchedSetD.add(d)
writeonlySet = set()
for d in definitionSet:
parentClazz = d[0];
- if d in readFromSet:
+ if d in readFromSet or d in untouchedSetD:
continue
srcLoc = definitionToSourceLocationMap[d];
# this is all representations of on-disk data structures
@@ -138,9 +140,12 @@ for d in definitionSet:
if "Guard" in fieldType:
continue
# these are just all model classes
- if (srcLoc.startswith("oox/") or srcLoc.startswith("lotuswordpro/")
- or srcLoc.startswith("include/oox/") or srcLoc.startswith("include/filter/")
- or srcLoc.startswith("hwpfilter/") or srcLoc.startswith("filter/")):
+ if (srcLoc.startswith("oox/")
+ or srcLoc.startswith("lotuswordpro/")
+ or srcLoc.startswith("include/oox/")
+ or srcLoc.startswith("include/filter/")
+ or srcLoc.startswith("hwpfilter/")
+ or srcLoc.startswith("filter/")):
continue
writeonlySet.add((d[0] + " " + d[1] + " " + definitionToTypeMap[d], srcLoc))
@@ -149,7 +154,7 @@ for d in definitionSet:
readonlySet = set()
for d in definitionSet:
parentClazz = d[0];
- if d in writeToSet:
+ if d in writeToSet or d in untouchedSetD:
continue
fieldType = definitionToTypeMap[d]
srcLoc = definitionToSourceLocationMap[d];