summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-01-19 09:40:25 +0200
committerNoel Grandin <noel@peralex.com>2016-01-19 11:01:56 +0200
commit5fe99ea3ee7b33a80f1419f2a4c9c1ea56dd00ee (patch)
tree0afae9735b407fe08421d19d702708a28f1e97c3 /compilerplugins
parent39969defa29948d77565a7cd8a3471baaec8f35d (diff)
loplugin:unusedmethods in sw/
Change-Id: Id452bfac5c83f130a138e06984a0c79c37af70ac
Diffstat (limited to 'compilerplugins')
-rwxr-xr-xcompilerplugins/clang/unusedmethods.py28
1 files changed, 13 insertions, 15 deletions
diff --git a/compilerplugins/clang/unusedmethods.py b/compilerplugins/clang/unusedmethods.py
index fb2ad7f15029..d5c7946da822 100755
--- a/compilerplugins/clang/unusedmethods.py
+++ b/compilerplugins/clang/unusedmethods.py
@@ -178,15 +178,13 @@ for d in definitionSet:
continue
if d in callSet:
continue
- # ignore operators, they are normally called from inside STL code
- if "::operator" in d[1]:
+ if isOtherConstness(d, callSet):
continue
- # ignore the custom RTTI stuff
- if ( ("::CreateType()" in d[1])
- or ("::IsA(" in d[1])
- or ("::Type()" in d[1])):
+ # include assigment operators, if we remove them, the compiler creates a default one, which can have odd consequences
+ if "::operator=(" in d[1]:
continue
- if isOtherConstness(d, callSet):
+ # these are only invoked implicitly, so the plugin does not see the calls
+ if "::operator new(" in d[1] or "::operator delete(" in d[1]:
continue
# just ignore iterators, they normally occur in pairs, and we typically want to leave one constness version alone
# alone if the other one is in use.
@@ -198,9 +196,6 @@ for d in definitionSet:
# used by Windows build
if any(x in d[1] for x in ["DdeTopic::", "DdeData::", "DdeService::", "DdeTransaction::", "DdeConnection::", "DdeLink::", "DdeItem::", "DdeGetPutItem::"]):
continue
- # the include/tools/rtti.hxx stuff
- if ("::StaticType()" in d[1]) or ("::IsOf(void *(*)(void))" in d[1]):
- continue
# too much template magic here for my plugin
if ( ("cairocanvas::" in d[1])
or ("canvas::" in d[1])
@@ -231,6 +226,9 @@ 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 the SfxPoolItem CreateDefault methods for now
+ if d[1].endswith("::CreateDefault()"):
+ continue
tmp1set.add((clazz, definitionToSourceLocationMap[d]))
@@ -243,10 +241,10 @@ def natural_sort_key(s, _nsre=re.compile('([0-9]+)')):
tmp1list = sorted(tmp1set, key=lambda v: natural_sort_key(v[1]))
# print out the results
-#for t in tmp1list:
-# print t[1]
-# print " ", t[0]
-
+for t in tmp1list:
+ print t[1]
+ print " ", t[0]
+sys.exit(0)
# -------------------------------------------
# Do the "unused return types" part
@@ -279,7 +277,7 @@ for d in definitionSet:
if definitionToSourceLocationMap[d].startswith("external/"):
continue
# ignore the SfxPoolItem CreateDefault methods for now
- if "::CreateDefault" in d[1]:
+ if d[1].endswith("::CreateDefault()"):
continue
tmp2set.add((clazz, definitionToSourceLocationMap[d]))