Index: clang-tools-extra/clang-tidy/add_new_check.py =================================================================== --- clang-tools-extra/clang-tidy/add_new_check.py +++ clang-tools-extra/clang-tidy/add_new_check.py @@ -324,16 +324,19 @@ dirname, _, check_name = check_name.partition("-") checker_code = get_actual_filename(os.path.join(clang_tidy_path, dirname), - get_camel_name(check_name) + '.cpp') - + get_camel_check_name(check_name) + '.cpp') if not os.path.isfile(checker_code): - return "" + # Some older checks don't end with 'Check.cpp' + checker_code = get_actual_filename(os.path.join(clang_tidy_path, dirname), get_camel_name(check_name) + '.cpp') + if not os.path.isfile(checker_code): + return '' with io.open(checker_code, encoding='utf8') as f: code = f.read() - if 'FixItHint' in code or "ReplacementText" in code or "fixit" in code: - # Some simple heuristics to figure out if a checker has an autofix or not. - return ' "Yes"' + for needle in ['FixItHint', 'ReplacementText', 'fixit', 'TransformerClangTidyCheck']: + if needle in code: + # Some simple heuristics to figure out if a checker has an autofix or not. + return ' "Yes"' return "" def process_doc(doc_file): @@ -416,7 +419,11 @@ def get_camel_name(check_name): return ''.join(map(lambda elem: elem.capitalize(), - check_name.split('-'))) + 'Check' + check_name.split('-'))) + + +def get_camel_check_name(check_name): + return get_camel_name(check_name) + 'Check' def main(): @@ -458,7 +465,7 @@ module = args.module check_name = args.check - check_name_camel = get_camel_name(check_name) + check_name_camel = get_camel_check_name(check_name) if check_name.startswith(module): print('Check name "%s" must not start with the module "%s". Exiting.' % ( check_name, module)) Index: clang-tools-extra/clang-tidy/utils/TransformerClangTidyCheck.h =================================================================== --- clang-tools-extra/clang-tidy/utils/TransformerClangTidyCheck.h +++ clang-tools-extra/clang-tidy/utils/TransformerClangTidyCheck.h @@ -54,7 +54,7 @@ StringRef Name, ClangTidyContext *Context); /// Convenience overload of the constructor when the rule doesn't have any - /// dependies. + /// dependencies. TransformerClangTidyCheck(transformer::RewriteRule R, StringRef Name, ClangTidyContext *Context); Index: clang-tools-extra/docs/clang-tidy/checks/list.rst =================================================================== --- clang-tools-extra/docs/clang-tidy/checks/list.rst +++ clang-tools-extra/docs/clang-tidy/checks/list.rst @@ -116,13 +116,12 @@ `cert-dcl50-cpp `_, `cert-dcl58-cpp `_, `cert-env33-c `_, + `cert-err33-c `_, `cert-err34-c `_, `cert-err52-cpp `_, `cert-err58-cpp `_, `cert-err60-cpp `_, - `cert-exp42-c `_, `cert-flp30-c `_, - `cert-flp37-c `_, `cert-mem57-cpp `_, `cert-msc50-cpp `_, `cert-msc51-cpp `_, @@ -213,7 +212,7 @@ `llvmlibc-implementation-in-namespace `_, `llvmlibc-restrict-system-libc-headers `_, "Yes" `misc-definitions-in-headers `_, "Yes" - `misc-misleading-identifier `_, + `misc-misleading-identifier `_, `misc-misplaced-const `_, `misc-new-delete-overloads `_, `misc-no-recursion `_, @@ -260,8 +259,8 @@ `modernize-use-using `_, "Yes" `mpi-buffer-deref `_, "Yes" `mpi-type-mismatch `_, "Yes" - `objc-avoid-nserror-init `_, `objc-assert-equals `_, "Yes" + `objc-avoid-nserror-init `_, `objc-dealloc-in-category `_, `objc-forbidden-subclassing `_, `objc-missing-hash `_, @@ -283,16 +282,16 @@ `performance-noexcept-move-constructor `_, "Yes" `performance-trivially-destructible `_, "Yes" `performance-type-promotion-in-math-fn `_, "Yes" - `performance-unnecessary-copy-initialization `_, + `performance-unnecessary-copy-initialization `_, "Yes" `performance-unnecessary-value-param `_, "Yes" `portability-restrict-system-includes `_, "Yes" `portability-simd-intrinsics `_, - `readability-avoid-const-params-in-decls `_, + `readability-avoid-const-params-in-decls `_, "Yes" `readability-braces-around-statements `_, "Yes" `readability-const-return-type `_, "Yes" `readability-container-data-pointer `_, "Yes" `readability-container-size-empty `_, "Yes" - `readability-convert-member-functions-to-static `_, + `readability-convert-member-functions-to-static `_, "Yes" `readability-delete-null-pointer `_, "Yes" `readability-else-after-return `_, "Yes" `readability-function-cognitive-complexity `_, @@ -338,13 +337,14 @@ `cert-dcl03-c `_, `misc-static-assert `_, "Yes" `cert-dcl16-c `_, `readability-uppercase-literal-suffix `_, "Yes" `cert-dcl37-c `_, `bugprone-reserved-identifier `_, "Yes" - `cert-err33-c `_, `bugprone-unused-return-value `_, `cert-dcl51-cpp `_, `bugprone-reserved-identifier `_, "Yes" `cert-dcl54-cpp `_, `misc-new-delete-overloads `_, `cert-dcl59-cpp `_, `google-build-namespaces `_, `cert-err09-cpp `_, `misc-throw-by-value-catch-by-reference `_, `cert-err61-cpp `_, `misc-throw-by-value-catch-by-reference `_, + `cert-exp42-c `_, `bugprone-suspicious-memory-comparison `_, `cert-fio38-c `_, `misc-non-copyable-objects `_, + `cert-flp37-c `_, `bugprone-suspicious-memory-comparison `_, `cert-msc30-c `_, `cert-msc50-cpp `_, `cert-msc32-c `_, `cert-msc51-cpp `_, `cert-oop11-cpp `_, `performance-move-constructor-init `_,