[clang-tools-extra] r319062 - [clang-tidy] Rename qualified references to check class + support inconsistent names
Alexander Kornienko via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 27 09:59:26 PST 2017
Author: alexfh
Date: Mon Nov 27 09:59:26 2017
New Revision: 319062
URL: http://llvm.org/viewvc/llvm-project?rev=319062&view=rev
Log:
[clang-tidy] Rename qualified references to check class + support inconsistent names
Modified:
clang-tools-extra/trunk/clang-tidy/rename_check.py
Modified: clang-tools-extra/trunk/clang-tidy/rename_check.py
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/rename_check.py?rev=319062&r1=319061&r2=319062&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/rename_check.py (original)
+++ clang-tools-extra/trunk/clang-tidy/rename_check.py Mon Nov 27 09:59:26 2017
@@ -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:
More information about the cfe-commits
mailing list