[clang-tidy] Rename qualified references to check class + support inconsistent names

llvm-svn: 319062
This commit is contained in:
Alexander Kornienko 2017-11-27 17:59:26 +00:00
parent a8efe6d9a5
commit 1f71b91254

View File

@ -184,12 +184,19 @@ def main():
help='Old check name.')
parser.add_argument('new_check_name', type=str,
help='New check name.')
parser.add_argument('--check_class_name', type=str,
help='Old name of the class implementing the check.')
args = parser.parse_args()
old_module = args.old_check_name.split('-')[0]
new_module = args.new_check_name.split('-')[0]
check_name_camel = ''.join(map(lambda elem: elem.capitalize(),
args.old_check_name.split('-')[1:])) + 'Check'
if args.check_class_name:
check_name_camel = args.check_class_name
else:
check_name_camel = (''.join(map(lambda elem: elem.capitalize(),
args.old_check_name.split('-')[1:])) +
'Check')
new_check_name_camel = (''.join(map(lambda elem: elem.capitalize(),
args.new_check_name.split('-')[1:])) +
'Check')
@ -237,6 +244,10 @@ def main():
args.new_check_name + '\n' + '=' * len(args.new_check_name) + '\n')
replaceInFile(filename, args.old_check_name, args.new_check_name)
replaceInFile(filename, old_module + '::' + check_name_camel,
new_module + '::' + new_check_name_camel)
replaceInFile(filename, old_module + '/' + check_name_camel,
new_module + '/' + new_check_name_camel)
replaceInFile(filename, check_name_camel, new_check_name_camel)
if old_module != new_module: