loplugins: more consistent naming of output files
Change-Id: Ia26f697cb16078f235c94e4cff449a60c1bbd74e
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
The process goes something like this:
|
||||
$ make check
|
||||
$ make FORCE_COMPILE_ALL=1 COMPILER_PLUGIN_TOOL='constantparam' check
|
||||
$ ./compilerplugins/clang/constantparam.py constantparam.log
|
||||
$ ./compilerplugins/clang/constantparam.py
|
||||
*/
|
||||
|
||||
namespace {
|
||||
@@ -84,7 +84,7 @@ public:
|
||||
output += s.returnType + "\t" + s.nameAndParams + "\t" + s.sourceLocation + "\t"
|
||||
+ s.paramName + "\t" + s.callValue + "\n";
|
||||
ofstream myfile;
|
||||
myfile.open( SRCDIR "/constantparam.log", ios::app | ios::out);
|
||||
myfile.open( SRCDIR "/loplugin.constantparam.log", ios::app | ios::out);
|
||||
myfile << output;
|
||||
myfile.close();
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@ def normalizeTypeParams( line ):
|
||||
return normalizeTypeParamsRegex.sub("type-parameter-?-?", line)
|
||||
|
||||
# reading as binary (since we known it is pure ascii) is much faster than reading as unicode
|
||||
with io.open(sys.argv[1], "rb", buffering=1024*1024) as txt:
|
||||
with io.open("loplugin.constantparam.log", "rb", buffering=1024*1024) as txt:
|
||||
for line in txt:
|
||||
idx1 = line.find("\t")
|
||||
idx2 = line.find("\t",idx1+1)
|
||||
@@ -57,7 +57,7 @@ def natural_sort_key(s, _nsre=re.compile('([0-9]+)')):
|
||||
tmp1list.sort(key=lambda v: natural_sort_key(v[2]))
|
||||
|
||||
# print out the results
|
||||
with open("unused.constantparams", "wt") as f:
|
||||
with open("loplugin.constantparams.report", "wt") as f:
|
||||
for v in tmp1list:
|
||||
f.write(v[2] + "\n")
|
||||
f.write(" " + v[0] + "\n")
|
||||
|
@@ -32,7 +32,7 @@ Then
|
||||
The process goes something like this:
|
||||
$ make check
|
||||
$ make FORCE_COMPILE_ALL=1 COMPILER_PLUGIN_TOOL='mergeclasses' check
|
||||
$ ./compilerplugins/clang/mergeclasses.py > mergeclasses.results
|
||||
$ ./compilerplugins/clang/mergeclasses.py
|
||||
|
||||
FIXME exclude 'static-only' classes, which some people may use/have used instead of a namespace to tie together a bunch of functions
|
||||
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
for (const std::pair<std::string,std::string> & s : definitionMap)
|
||||
output += "definition:\t" + s.first + "\t" + s.second + "\n";
|
||||
ofstream myfile;
|
||||
myfile.open( SRCDIR "/mergeclasses.log", ios::app | ios::out);
|
||||
myfile.open( SRCDIR "/loplugin.mergeclasses.log", ios::app | ios::out);
|
||||
myfile << output;
|
||||
myfile.close();
|
||||
}
|
||||
|
@@ -7,7 +7,7 @@ definitionSet = set()
|
||||
parentChildDict = {}
|
||||
definitionToFileDict = {}
|
||||
|
||||
with open("mergeclasses.log") as txt:
|
||||
with open("loplugin.mergeclasses.log") as txt:
|
||||
for line in txt:
|
||||
|
||||
if line.startswith("instantiated:\t"):
|
||||
@@ -54,6 +54,7 @@ def extractModuleName(clazz):
|
||||
idx = filename.find("/")
|
||||
return filename[:idx]
|
||||
|
||||
with open("loplugin.mergeclasses.report", "wt") as f:
|
||||
for clazz in sorted(definitionSet - instantiatedSet):
|
||||
# find uninstantiated classes without any subclasses
|
||||
if (not(clazz in parentChildDict)) or (len(parentChildDict[clazz]) != 1):
|
||||
@@ -70,5 +71,5 @@ for clazz in sorted(definitionSet - instantiatedSet):
|
||||
# exclude combinations that span modules because we often use those to make cross-module dependencies more manageable.
|
||||
if extractModuleName(clazz) != extractModuleName(otherclazz):
|
||||
continue
|
||||
print "merge", clazz, "with", otherclazz
|
||||
f.write( "merge" + clazz + "with" + otherclazz + "\n" )
|
||||
|
||||
|
@@ -85,7 +85,7 @@ public:
|
||||
for (const MyFieldInfo & s : definitionSet)
|
||||
output += "defn:\t" + s.parentClass + "\t" + s.fieldName + "\t" + s.sourceLocation + "\n";
|
||||
ofstream myfile;
|
||||
myfile.open( SRCDIR "/singlevalfields.log", ios::app | ios::out);
|
||||
myfile.open( SRCDIR "/loplugin.singlevalfields.log", ios::app | ios::out);
|
||||
myfile << output;
|
||||
myfile.close();
|
||||
}
|
||||
|
@@ -14,7 +14,7 @@ def normalizeTypeParams( line ):
|
||||
return normalizeTypeParamsRegex.sub("type-parameter-?-?", line)
|
||||
|
||||
# reading as binary (since we known it is pure ascii) is much faster than reading as unicode
|
||||
with io.open("singlevalfields.log", "rb", buffering=1024*1024) as txt:
|
||||
with io.open("loplugin.singlevalfields.log", "rb", buffering=1024*1024) as txt:
|
||||
for line in txt:
|
||||
if line.startswith("defn:\t"):
|
||||
idx1 = line.find("\t")
|
||||
@@ -67,7 +67,7 @@ def natural_sort_key(s, _nsre=re.compile('([0-9]+)')):
|
||||
tmp1list.sort(key=lambda v: natural_sort_key(v[2]))
|
||||
|
||||
# print out the results
|
||||
with open("loplugin.singlevalfields", "wt") as f:
|
||||
with open("loplugin.singlevalfields.report", "wt") as f:
|
||||
for v in tmp1list:
|
||||
f.write(v[2] + "\n")
|
||||
f.write(" " + v[0] + "\n")
|
||||
|
@@ -24,7 +24,7 @@
|
||||
The process goes something like this:
|
||||
$ make check
|
||||
$ make FORCE_COMPILE_ALL=1 COMPILER_PLUGIN_TOOL='unuseddefaultparams' check
|
||||
$ ./compilerplugins/clang/unuseddefaultparams.py unuseddefaultparams.log
|
||||
$ ./compilerplugins/clang/unuseddefaultparams.py
|
||||
*/
|
||||
|
||||
namespace {
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
for (const MyFuncInfo & s : callSet)
|
||||
output += "call:\t" + s.returnType + "\t" + s.nameAndParams + "\n";
|
||||
ofstream myfile;
|
||||
myfile.open( SRCDIR "/unuseddefaultparams.log", ios::app | ios::out);
|
||||
myfile.open( SRCDIR "/loplugin.unuseddefaultparams.log", ios::app | ios::out);
|
||||
myfile << output;
|
||||
myfile.close();
|
||||
}
|
||||
|
@@ -22,7 +22,7 @@ def normalizeTypeParams( line ):
|
||||
|
||||
# The parsing here is designed to avoid grabbing stuff which is mixed in from gbuild.
|
||||
# I have not yet found a way of suppressing the gbuild output.
|
||||
with io.open(sys.argv[1], "rb", buffering=1024*1024) as txt:
|
||||
with io.open("loplugin.unuseddefaultparams.log", "rb", buffering=1024*1024) as txt:
|
||||
for line in txt:
|
||||
if line.startswith("defn:\t"):
|
||||
idx1 = line.find("\t",6)
|
||||
@@ -72,7 +72,7 @@ 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
|
||||
with open("unused.defaultparams", "wt") as f:
|
||||
with open("loplugin.unuseddefaultparams.report", "wt") as f:
|
||||
for t in tmp1list:
|
||||
f.write(t[1] + "\n")
|
||||
f.write(" " + t[0] + "\n")
|
||||
|
@@ -28,7 +28,7 @@ Be warned that it produces around 5G of log file.
|
||||
The process goes something like this:
|
||||
$ make check
|
||||
$ make FORCE_COMPILE_ALL=1 COMPILER_PLUGIN_TOOL='unusedfields' check
|
||||
$ ./compilerplugins/clang/unusedfields.py unusedfields.log
|
||||
$ ./compilerplugins/clang/unusedfields.py
|
||||
|
||||
and then
|
||||
$ for dir in *; do make FORCE_COMPILE_ALL=1 UPDATE_FILES=$dir COMPILER_PLUGIN_TOOL='unusedfieldsremove' $dir; done
|
||||
@@ -83,7 +83,7 @@ public:
|
||||
output += "definition:\t" + s.parentClass + "\t" + s.fieldName + "\t" + s.fieldType + "\t" + s.sourceLocation + "\n";
|
||||
}
|
||||
ofstream myfile;
|
||||
myfile.open( SRCDIR "/unusedfields.log", ios::app | ios::out);
|
||||
myfile.open( SRCDIR "/loplugin.unusedfields.log", ios::app | ios::out);
|
||||
myfile << output;
|
||||
myfile.close();
|
||||
}
|
||||
|
@@ -23,7 +23,7 @@ def normalizeTypeParams( line ):
|
||||
|
||||
# The parsing here is designed to avoid grabbing stuff which is mixed in from gbuild.
|
||||
# I have not yet found a way of suppressing the gbuild output.
|
||||
with io.open(sys.argv[1], "rb", buffering=1024*1024) as txt:
|
||||
with io.open("loplugin.unusedfields.log", "rb", buffering=1024*1024) as txt:
|
||||
for line in txt:
|
||||
if line.startswith("definition:\t"):
|
||||
idx1 = line.find("\t",12)
|
||||
@@ -141,11 +141,11 @@ tmp1list = sorted(untouchedSet, key=lambda v: natural_sort_key(v[1]))
|
||||
tmp2list = sorted(writeonlySet, key=lambda v: natural_sort_key(v[1]))
|
||||
|
||||
# print out the results
|
||||
with open("unusedfields.untouched", "wt") as f:
|
||||
with open("loplugin.unusedfields.report-untouched", "wt") as f:
|
||||
for t in tmp1list:
|
||||
f.write( t[1] + "\n" )
|
||||
f.write( " " + t[0] + "\n" )
|
||||
with open("unusedfields.writeonly", "wt") as f:
|
||||
with open("loplugin.unusedfields.report-writeonly", "wt") as f:
|
||||
for t in tmp2list:
|
||||
f.write( t[1] + "\n" )
|
||||
f.write( " " + t[0] + "\n" )
|
||||
|
@@ -33,7 +33,7 @@ Be warned that it produces around 15G of log file.
|
||||
The process goes something like this:
|
||||
$ make check
|
||||
$ make FORCE_COMPILE_ALL=1 COMPILER_PLUGIN_TOOL='unusedmethods' check
|
||||
$ ./compilerplugins/clang/unusedmethods.py unusedmethods.log
|
||||
$ ./compilerplugins/clang/unusedmethods.py
|
||||
|
||||
and then
|
||||
$ for dir in *; do make FORCE_COMPILE_ALL=1 UPDATE_FILES=$dir COMPILER_PLUGIN_TOOL='unusedmethodsremove' $dir; done
|
||||
@@ -100,7 +100,7 @@ public:
|
||||
for (const MyFuncInfo & s : calledFromOutsideSet)
|
||||
output += "outside:\t" + s.returnType + "\t" + s.nameAndParams + "\n";
|
||||
ofstream myfile;
|
||||
myfile.open( SRCDIR "/unusedmethods.log", ios::app | ios::out);
|
||||
myfile.open( SRCDIR "/loplugin.unusedmethods.log", ios::app | ios::out);
|
||||
myfile << output;
|
||||
myfile.close();
|
||||
}
|
||||
|
@@ -133,7 +133,7 @@ def normalizeTypeParams( line ):
|
||||
|
||||
# The parsing here is designed to avoid grabbing stuff which is mixed in from gbuild.
|
||||
# I have not yet found a way of suppressing the gbuild output.
|
||||
with io.open(sys.argv[1], "rb", buffering=1024*1024) as txt:
|
||||
with io.open("loplugin.unusedmethods.log", "rb", buffering=1024*1024) as txt:
|
||||
for line in txt:
|
||||
if line.startswith("definition:\t"):
|
||||
idx1 = line.find("\t",12)
|
||||
@@ -278,7 +278,7 @@ for d in definitionSet:
|
||||
tmp1set.add((method, definitionToSourceLocationMap[d]))
|
||||
|
||||
# print out the results, sorted by name and line number
|
||||
with open("unused.methods", "wt") as f:
|
||||
with open("loplugin.unusedmethods.report-methods", "wt") as f:
|
||||
for t in sort_set_by_natural_key(tmp1set):
|
||||
f.write(t[1] + "\n")
|
||||
f.write(" " + t[0] + "\n")
|
||||
@@ -323,7 +323,7 @@ for d in definitionSet:
|
||||
tmp2set.add((method, definitionToSourceLocationMap[d]))
|
||||
|
||||
# print output, sorted by name and line number
|
||||
with open("unused.returns", "wt") as f:
|
||||
with open("loplugin.unusedmethods.report-returns", "wt") as f:
|
||||
for t in sort_set_by_natural_key(tmp2set):
|
||||
f.write(t[1] + "\n")
|
||||
f.write(" " + t[0] + "\n")
|
||||
@@ -346,7 +346,7 @@ for d in publicDefinitionSet:
|
||||
tmp3set.add((method, definitionToSourceLocationMap[d]))
|
||||
|
||||
# print output, sorted by name and line number
|
||||
with open("unused.public", "wt") as f:
|
||||
with open("loplugin.unusedmethods.report-public", "wt") as f:
|
||||
for t in sort_set_by_natural_key(tmp3set):
|
||||
f.write(t[1] + "\n")
|
||||
f.write(" " + t[0] + "\n")
|
||||
|
Reference in New Issue
Block a user