llvm-project/clang-tools-extra/clang-tidy/modernize
Adam Balogh dbd45b2db8 [ASTMatchers] Fix `hasBody` for the descendants of `FunctionDecl`
//AST Matcher// `hasBody` is a polymorphic matcher that behaves
differently for loop statements and function declarations. The main
difference is the for functions declarations it does not only call
`FunctionDecl::getBody()` but first checks whether the declaration in
question is that specific declaration which has the body by calling
`FunctionDecl::doesThisDeclarationHaveABody()`. This is achieved by
specialization of the template `GetBodyMatcher`. Unfortunately template
specializations do not catch the descendants of the class for which the
template is specialized. Therefore it does not work correcly for the
descendants of `FunctionDecl`, such as `CXXMethodDecl`,
`CXXConstructorDecl`, `CXXDestructorDecl` etc. This patch fixes this
issue by using a template metaprogram.

The patch also introduces a new matcher `hasAnyBody` which matches
declarations which have a body present in the AST but not necessarily
belonging to that particular declaration.

Differential Revision: https://reviews.llvm.org/D87527
2020-09-16 13:16:51 +02:00
..
AvoidBindCheck.cpp [NFC] Use hasAnyName matcher in place of anyOf(hasName()...) 2020-07-07 14:31:04 +01:00
AvoidBindCheck.h [clang-tidy] Implement storeOptions for checks missing it. 2020-06-21 19:01:11 +01:00
AvoidCArraysCheck.cpp [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
AvoidCArraysCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
CMakeLists.txt [openmp] Add missing dependencies for OMP.h.inc after d90443b 2020-06-23 11:48:04 -04:00
ConcatNestedNamespacesCheck.cpp [clang-tidy][NFC] Remove unnecessary includes throughout clang-tidy header files 2020-06-29 16:05:52 +01:00
ConcatNestedNamespacesCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
DeprecatedHeadersCheck.cpp [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
DeprecatedHeadersCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
DeprecatedIosBaseAliasesCheck.cpp [clang-tidy] Use StringSwitch in a bunch of places. NFCI. 2020-04-26 17:24:47 +02:00
DeprecatedIosBaseAliasesCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
LoopConvertCheck.cpp [clang-tidy] Reworked enum options handling(again) 2020-07-11 10:13:20 +01:00
LoopConvertCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
LoopConvertUtils.cpp Fix the clang-tidy build after get/isIntegerConstantExpression 2020-07-22 09:38:56 +02:00
LoopConvertUtils.h Removed a RecursiveASTVisitor feature to visit operator kinds with different methods 2020-07-06 13:38:01 +02:00
MakeSharedCheck.cpp [clang-tidy] Improved accuracy of check list updater script 2020-06-22 11:07:24 +01:00
MakeSharedCheck.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
MakeSmartPtrCheck.cpp [clang-tidy] Refactor IncludeInserter 2020-07-27 12:48:55 +01:00
MakeSmartPtrCheck.h [clang-tidy] Refactor IncludeInserter 2020-07-27 12:48:55 +01:00
MakeUniqueCheck.cpp MakeUniqueCheck.cpp: explicit the fact that there is an autofix for this checker 2020-01-10 22:06:03 +01:00
MakeUniqueCheck.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ModernizeTidyModule.cpp [clang-tidy]: Added modernize-replace-disallow-copy-and-assign-macro 2020-06-03 16:56:03 -04:00
PassByValueCheck.cpp [clang-tidy] Refactor IncludeInserter 2020-07-27 12:48:55 +01:00
PassByValueCheck.h [clang-tidy] Refactor IncludeInserter 2020-07-27 12:48:55 +01:00
RawStringLiteralCheck.cpp [clang-tidy] Implement storeOptions for checks missing it. 2020-06-21 19:01:11 +01:00
RawStringLiteralCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
RedundantVoidArgCheck.cpp [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
RedundantVoidArgCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
ReplaceAutoPtrCheck.cpp [clang-tidy] Refactor IncludeInserter 2020-07-27 12:48:55 +01:00
ReplaceAutoPtrCheck.h [clang-tidy] Refactor IncludeInserter 2020-07-27 12:48:55 +01:00
ReplaceDisallowCopyAndAssignMacroCheck.cpp [clang-tidy][NFC] Remove unnecessary includes throughout clang-tidy header files 2020-06-29 16:05:52 +01:00
ReplaceDisallowCopyAndAssignMacroCheck.h [clang-tidy]: Added modernize-replace-disallow-copy-and-assign-macro 2020-06-03 16:56:03 -04:00
ReplaceRandomShuffleCheck.cpp [clang-tidy] Refactor IncludeInserter 2020-07-27 12:48:55 +01:00
ReplaceRandomShuffleCheck.h [clang-tidy] Refactor IncludeInserter 2020-07-27 12:48:55 +01:00
ReturnBracedInitListCheck.cpp Set traversal explicitly where needed in clang-tidy 2020-05-21 22:34:37 +01:00
ReturnBracedInitListCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
ShrinkToFitCheck.cpp Set traversal explicitly where needed in clang-tidy 2020-05-21 22:34:37 +01:00
ShrinkToFitCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
UnaryStaticAssertCheck.cpp [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
UnaryStaticAssertCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
UseAutoCheck.cpp [Ignore Expressions][NFC] Refactor to better use `IgnoreExpr.h` and nits 2020-09-07 09:32:30 +00:00
UseAutoCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
UseBoolLiteralsCheck.cpp [clang-tidy] Implement storeOptions for checks missing it. 2020-06-21 19:01:11 +01:00
UseBoolLiteralsCheck.h [clang-tidy] Implement storeOptions for checks missing it. 2020-06-21 19:01:11 +01:00
UseDefaultMemberInitCheck.cpp C++2a -> C++20 in some identifiers; NFC. 2020-04-21 15:37:19 -04:00
UseDefaultMemberInitCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
UseEmplaceCheck.cpp [clang-tidy] Implement storeOptions for checks missing it. 2020-06-21 19:01:11 +01:00
UseEmplaceCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
UseEqualsDefaultCheck.cpp Set traversal explicitly where needed in clang-tidy 2020-05-21 22:34:37 +01:00
UseEqualsDefaultCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
UseEqualsDeleteCheck.cpp [ASTMatchers] Fix `hasBody` for the descendants of `FunctionDecl` 2020-09-16 13:16:51 +02:00
UseEqualsDeleteCheck.h [clang-tidy] Convert config options that are bools to use the bool overload of get(GlobalOrLocal)? 2020-04-12 23:06:09 +01:00
UseNodiscardCheck.cpp [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
UseNodiscardCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
UseNoexceptCheck.cpp [clang-tidy] Fix crash in modernize-use-noexcept on uninstantiated throw class 2020-09-16 08:13:00 +03:00
UseNoexceptCheck.h [clang-tidy] Fix potential assert in use-noexcept check 2020-05-24 14:40:58 +01:00
UseNullptrCheck.cpp Set traversal explicitly where needed in clang-tidy 2020-05-21 22:34:37 +01:00
UseNullptrCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
UseOverrideCheck.cpp [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
UseOverrideCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
UseTrailingReturnTypeCheck.cpp Add support for C++20 concepts and decltype to modernize-use-trailing-return-type. 2020-08-15 10:40:22 -04:00
UseTrailingReturnTypeCheck.h Add support for C++20 concepts and decltype to modernize-use-trailing-return-type. 2020-08-15 10:40:22 -04:00
UseTransparentFunctorsCheck.cpp [clang-tidy] Implement storeOptions for checks missing it. 2020-06-21 19:01:11 +01:00
UseTransparentFunctorsCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
UseUncaughtExceptionsCheck.cpp [clang-tidy][NFC] Remove unnecessary includes throughout clang-tidy header files 2020-06-29 16:05:52 +01:00
UseUncaughtExceptionsCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
UseUsingCheck.cpp [clang-tidy] Implement storeOptions for checks missing it. 2020-06-21 19:01:11 +01:00
UseUsingCheck.h [clang-tidy] Implement storeOptions for checks missing it. 2020-06-21 19:01:11 +01:00