diff options
Diffstat (limited to 'compilerplugins/clang/mergeclasses.py')
-rwxr-xr-x | compilerplugins/clang/mergeclasses.py | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/compilerplugins/clang/mergeclasses.py b/compilerplugins/clang/mergeclasses.py index bc6d129eeb3f..ccf2b66f7f9c 100755 --- a/compilerplugins/clang/mergeclasses.py +++ b/compilerplugins/clang/mergeclasses.py @@ -1,7 +1,5 @@ #!/usr/bin/python3 -import sys - instantiatedSet = set() definitionSet = set() parentChildDict = {} @@ -56,7 +54,6 @@ 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,11 +65,16 @@ with open("compilerplugins/clang/mergeclasses.results", "wt") as f: # help with the WeakComponentImpl template magic if ("mutex" in clazz) or ("Mutex" in clazz): continue - otherclazz = next(iter(parentChildDict[clazz])) - if clazz == "svl::IUndoManager": print(extractModuleName(clazz)) - if otherclazz == "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 - f.write( "merge " + clazz + " with " + otherclazz + "\n" ) + subclazz = next(iter(parentChildDict[clazz])) + # if the other class has more than child, it is not a candidate for merging + #if (otherclazz in parentChildDict) and (len(parentChildDict[otherclazz]) != 1): + # continue + # Combinations that span modules we often use those to make cross-module dependencies more manageable, + # so mark them with maybe. + module1 = extractModuleName(clazz) + module2 = extractModuleName(subclazz) + if module1 != module2: + f.write( "maybe merge " + clazz + " with " + subclazz + ", in modules " + module1 + " and " + module2 + "\n" ) + else: + f.write( "merge " + clazz + " with " + subclazz + "\n" ) |