diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-12 11:14:13 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-12 12:41:01 +0200 |
commit | 85cf4d25a3df3da86840c69bc035d58212a9672c (patch) | |
tree | b8396222ee62d9192d83550f95276a7e008fca82 /compilerplugins | |
parent | 0d7193bd2cd2f1bd24232095d7617f0764c58a9b (diff) |
loplugin:mergeclasses fix ignoring some stuff
Seems that calling getCanonicalDecl here results in us sometimes picking
up forward-decl's, which hides stuff
Also make the python processing code spit out a message if I manage to
mess up the log files
Change-Id: I08bf50eb26cf463c126507b51535b0a0fc9f7ecf
Diffstat (limited to 'compilerplugins')
-rwxr-xr-x | compilerplugins/clang/countusersofdefaultparams.py | 2 | ||||
-rwxr-xr-x | compilerplugins/clang/finalclasses.py | 3 | ||||
-rw-r--r-- | compilerplugins/clang/mergeclasses.cxx | 2 | ||||
-rwxr-xr-x | compilerplugins/clang/mergeclasses.py | 3 | ||||
-rwxr-xr-x | compilerplugins/clang/singlevalfields.py | 2 | ||||
-rwxr-xr-x | compilerplugins/clang/virtualdown.py | 4 |
6 files changed, 14 insertions, 2 deletions
diff --git a/compilerplugins/clang/countusersofdefaultparams.py b/compilerplugins/clang/countusersofdefaultparams.py index 06c38b9e4807..d7ac6a62d8f2 100755 --- a/compilerplugins/clang/countusersofdefaultparams.py +++ b/compilerplugins/clang/countusersofdefaultparams.py @@ -35,6 +35,8 @@ with io.open("workdir/loplugin.countusersofdefaultparams.log", "rb", buffering=1 if not funcInfo in callDict: callDict[funcInfo] = set() callDict[funcInfo].add(sourceLocationOfCall) + else: + print( "unknown line: " + line) # Invert the definitionToSourceLocationMap. sourceLocationToDefinitionMap = {} diff --git a/compilerplugins/clang/finalclasses.py b/compilerplugins/clang/finalclasses.py index d2d4f695b8a1..f6c15ca2c87d 100755 --- a/compilerplugins/clang/finalclasses.py +++ b/compilerplugins/clang/finalclasses.py @@ -29,6 +29,9 @@ with open("workdir/loplugin.finalclasses.log") as txt: parent = parent[7:] inheritFromSet.add(parent); + else: + print( "unknown line: " + line) + tmpset = set() for clazz in sorted(definitionSet - inheritFromSet): file = definitionToFileDict[clazz] diff --git a/compilerplugins/clang/mergeclasses.cxx b/compilerplugins/clang/mergeclasses.cxx index ca6cdeac74be..6035e7c275dc 100644 --- a/compilerplugins/clang/mergeclasses.cxx +++ b/compilerplugins/clang/mergeclasses.cxx @@ -148,7 +148,7 @@ bool MergeClasses::VisitCXXRecordDecl(const CXXRecordDecl* decl) } if (decl->isThisDeclarationADefinition()) { - SourceLocation spellingLocation = compiler.getSourceManager().getSpellingLoc(decl->getCanonicalDecl()->getLocStart()); + SourceLocation spellingLocation = compiler.getSourceManager().getSpellingLoc(decl->getLocStart()); std::string filename = compiler.getSourceManager().getFilename(spellingLocation); filename = filename.substr(strlen(SRCDIR)); std::string s = decl->getQualifiedNameAsString(); diff --git a/compilerplugins/clang/mergeclasses.py b/compilerplugins/clang/mergeclasses.py index e070ee49e81a..902acf8b9aa9 100755 --- a/compilerplugins/clang/mergeclasses.py +++ b/compilerplugins/clang/mergeclasses.py @@ -56,6 +56,7 @@ def extractModuleName(clazz): with open("compilerplugins/clang/mergeclasses.results", "wt") as f: # loop over defined, but not instantiated classes for clazz in sorted(definitionSet - instantiatedSet): + if clazz == "svl::IUndoManager": print parentChildDict[clazz] # ignore classes without any children, and classes with more than one child if (clazz not in parentChildDict) or (len(parentChildDict[clazz]) != 1): continue @@ -68,6 +69,8 @@ with open("compilerplugins/clang/mergeclasses.results", "wt") as f: if ("mutex" in clazz) or ("Mutex" in clazz): continue otherclazz = next(iter(parentChildDict[clazz])) + if clazz == "svl::IUndoManager": print extractModuleName(clazz) + if clazz == "svl::IUndoManager": print extractModuleName(otherclazz) # exclude combinations that span modules because we often use those to make cross-module dependencies more manageable. if extractModuleName(clazz) != extractModuleName(otherclazz): continue diff --git a/compilerplugins/clang/singlevalfields.py b/compilerplugins/clang/singlevalfields.py index ae1025cb6e3d..b842929011b1 100755 --- a/compilerplugins/clang/singlevalfields.py +++ b/compilerplugins/clang/singlevalfields.py @@ -34,6 +34,8 @@ with io.open("workdir/loplugin.singlevalfields.log", "rb", buffering=1024*1024) if not fieldInfo in fieldAssignDict: fieldAssignDict[fieldInfo] = set() fieldAssignDict[fieldInfo].add(assignValue) + else: + print( "unknown line: " + line) tmp1list = list() for fieldInfo, assignValues in fieldAssignDict.iteritems(): diff --git a/compilerplugins/clang/virtualdown.py b/compilerplugins/clang/virtualdown.py index a1d5c6e80d9f..9c1346ff2831 100755 --- a/compilerplugins/clang/virtualdown.py +++ b/compilerplugins/clang/virtualdown.py @@ -20,7 +20,9 @@ with io.open("workdir/loplugin.virtualdown.log", "rb", buffering=1024*1024) as t elif tokens[0] == "call:": fullMethodName = tokens[1] callSet.add(fullMethodName) - + else: + print( "unknown line: " + line) + unnecessaryVirtualSet = set() for clazz in (definitionSet - callSet): |