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
This commit is contained in:
parent
0d7193bd2c
commit
85cf4d25a3
@ -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 = {}
|
||||
|
@ -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]
|
||||
|
@ -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();
|
||||
|
@ -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
|
||||
|
@ -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():
|
||||
|
@ -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):
|
||||
|
Loading…
x
Reference in New Issue
Block a user