summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-08-12 12:08:50 +0200
committerNoel Grandin <noelgrandin@gmail.com>2016-08-17 06:43:45 +0000
commit95be297746fda812f5a64e5fd53c753dfd9b249c (patch)
tree4765cbcc1c825480d58d236f2011b895e06101d5 /compilerplugins
parente0a3269183bf145511361a3968dca07824923dd4 (diff)
loplugin:unusedenumvalues in sw
Change-Id: Ia5faa65cd7824183cead2634edab96b5d23a6c02 Reviewed-on: https://gerrit.libreoffice.org/28072 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/unusedenumvalues.cxx1
-rwxr-xr-xcompilerplugins/clang/unusedenumvalues.py21
2 files changed, 15 insertions, 7 deletions
diff --git a/compilerplugins/clang/unusedenumvalues.cxx b/compilerplugins/clang/unusedenumvalues.cxx
index a478dfd5a570..6e3c87402a00 100644
--- a/compilerplugins/clang/unusedenumvalues.cxx
+++ b/compilerplugins/clang/unusedenumvalues.cxx
@@ -78,6 +78,7 @@ public:
}
bool shouldVisitTemplateInstantiations () const { return true; }
+ bool shouldVisitImplicitCode() const { return true; }
bool VisitEnumDecl( const EnumDecl* );
bool VisitDeclRefExpr( const DeclRefExpr* );
diff --git a/compilerplugins/clang/unusedenumvalues.py b/compilerplugins/clang/unusedenumvalues.py
index 746abe26d5d0..f601275ca453 100755
--- a/compilerplugins/clang/unusedenumvalues.py
+++ b/compilerplugins/clang/unusedenumvalues.py
@@ -7,9 +7,17 @@ import io
definitionSet = set()
definitionToSourceLocationMap = dict()
touchSet = set()
-# things we need to exclude for reasons like :
-# - it's a weird template thingy that confuses the plugin
-exclusionSet = set([
+# exclude some stuff, mostly because they are some kind of definition of external file formats
+excludedSourceFiles = set([
+ "include/svx/msdffdef.hxx",
+ "sw/source/filter/ww8/fields.hxx",
+ "sw/source/filter/inc/wwstyles.hxx",
+ "sw/inc/toxe.hxx",
+ "sw/inc/poolfmt.hxx",
+ "sw/inc/hintids.hxx",
+ ])
+excludedTypes = set([
+ "SwVarFormat", "RES_FIELDS", "SwFillOrder", "SwIoDetect", "SwDocumentSettingsPropertyHandles"
])
# clang does not always use exactly the same numbers in the type-parameter vars it generates
@@ -69,14 +77,13 @@ for d in definitionSet:
or srcLoc.startswith("include/typelib/")
or srcLoc.startswith("include/uno/")):
continue
- # definitions of external file formats
- if (srcLoc.startswith("include/svx/msdffdef.hxx"):
+ if srcLoc in excludedSourceFiles or d[0] in excludedTypes:
continue
# used in templates to find the last member of an enum
- if (d1.endswith("LAST"):
+ if d[1] == "LAST" or d[1].endswith("_END"):
continue
# used to aid in alignment of enum values
- if (d1.endswith("FORCE_EQUAL_SIZE"):
+ if d[1].endswith("FORCE_EQUAL_SIZE"):
continue
untouchedSet.add((clazz, srcLoc))