llvm-project/clang-tools-extra/clang-tidy
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
..
abseil [NFC][clang-tidy] Put abseil headers in alphabetical order 2020-08-18 15:52:47 +01:00
altera [clang-tidy] Fix linking for FrontendOpenMP 2020-09-08 09:22:22 -07:00
android [openmp] Add missing dependencies for OMP.h.inc after d90443b 2020-06-23 11:48:04 -04:00
boost [openmp] Add missing dependencies for OMP.h.inc after d90443b 2020-06-23 11:48:04 -04:00
bugprone [clang-tidy] Crash fix for bugprone-misplaced-pointer-arithmetic-in-alloc 2020-09-16 13:16:44 +02:00
cert [NFC] Use hasAnyName matcher in place of anyOf(hasName()...) 2020-07-07 14:31:04 +01:00
cppcoreguidelines Revert "[clang-tidy] New check readability-prefer-member-initializer" 2020-09-10 16:32:18 +03:00
darwin [openmp] Add missing dependencies for OMP.h.inc after d90443b 2020-06-23 11:48:04 -04:00
fuchsia [clang-tidy][NFC] Remove unnecessary includes throughout clang-tidy header files 2020-06-29 16:05:52 +01:00
google [clang-tidy][NFC] Remove unnecessary includes throughout clang-tidy header files 2020-06-29 16:05:52 +01:00
hicpp [clang-tidy][NFC] Remove unnecessary includes throughout clang-tidy header files 2020-06-29 16:05:52 +01:00
linuxkernel [openmp] Add missing dependencies for OMP.h.inc after d90443b 2020-06-23 11:48:04 -04:00
llvm [NFC] Use hasAnyName matcher in place of anyOf(hasName()...) 2020-07-07 14:31:04 +01:00
llvmlibc [clang-tidy][NFC] Remove unnecessary includes throughout clang-tidy header files 2020-06-29 16:05:52 +01:00
misc Fix the clang-tidy build after get/isIntegerConstantExpression 2020-07-22 09:38:56 +02:00
modernize [ASTMatchers] Fix `hasBody` for the descendants of `FunctionDecl` 2020-09-16 13:16:51 +02:00
mpi [openmp] Add missing dependencies for OMP.h.inc after d90443b 2020-06-23 11:48:04 -04:00
objc [clang-tidy][NFC] Remove unnecessary includes throughout clang-tidy header files 2020-06-29 16:05:52 +01:00
openmp [clang-tidy][NFC] Remove unnecessary includes throughout clang-tidy header files 2020-06-29 16:05:52 +01:00
performance Restrict UnnecessaryCopyInitialization check to variables initialized from free functions without arguments 2020-09-15 08:46:04 -04:00
plugin [openmp] Add missing dependencies for OMP.h.inc after d90443b 2020-06-23 11:48:04 -04:00
portability [clang-tidy][NFC] Remove unnecessary includes throughout clang-tidy header files 2020-06-29 16:05:52 +01:00
readability [Ignore Expressions][NFC] Refactor to better use `IgnoreExpr.h` and nits 2020-09-07 09:32:30 +00:00
tool Fix -allow-enabling-analyzer-alpha-checkers always being passed to run-clang-tidy.py 2020-08-20 09:15:29 -04:00
utils [libTooling] Move RewriteRule include edits to ASTEdit granularity. 2020-08-11 16:47:14 +00:00
zircon [openmp] Add missing dependencies for OMP.h.inc after d90443b 2020-06-23 11:48:04 -04:00
CMakeLists.txt Add an explicit toggle for the static analyzer in clang-tidy 2020-09-10 10:48:17 -04:00
ClangTidy.cpp Add an explicit toggle for the static analyzer in clang-tidy 2020-09-10 10:48:17 -04:00
ClangTidy.h [clang-tidy][NFC] Remove unnecessary includes throughout clang-tidy header files 2020-06-29 16:05:52 +01:00
ClangTidyCheck.cpp [clang-tidy][NFC] Added convienence methods for getting optional options 2020-08-01 01:45:34 +01:00
ClangTidyCheck.h [clang-tidy][NFC] Added convienence methods for getting optional options 2020-08-01 01:45:34 +01:00
ClangTidyDiagnosticConsumer.cpp [clang-tidy] use stable_sort instead of sort to fix EXPENSIVE_CHECKS tests 2020-08-12 12:12:10 -04:00
ClangTidyDiagnosticConsumer.h Add missing #include 2020-06-29 22:08:20 -07:00
ClangTidyForceLinker.h Add an explicit toggle for the static analyzer in clang-tidy 2020-09-10 10:48:17 -04:00
ClangTidyModule.cpp [clang-tidy][NFC] Use StringMap for ClangTidyCheckFactories::FacoryMap 2020-07-30 22:57:33 +01:00
ClangTidyModule.h [clang-tidy][NFC] Use StringMap for ClangTidyCheckFactories::FacoryMap 2020-07-30 22:57:33 +01:00
ClangTidyModuleRegistry.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ClangTidyOptions.cpp [clang-tidy] Fix build problem after commit 45a720a864 2020-07-31 14:29:03 +02:00
ClangTidyOptions.h [clang-tidy] Use StringMap for ClangTidyOptions::OptionsMap 2020-07-30 10:31:13 +01:00
ClangTidyProfiling.cpp Rename F_{None,Text,Append} to OF_{None,Text,Append}. NFC 2019-08-05 05:43:48 +00:00
ClangTidyProfiling.h [clang-tidy][NFC] Remove unnecessary includes throughout clang-tidy header files 2020-06-29 16:05:52 +01:00
ExpandModularHeadersPPCallbacks.cpp Prune TargetInfo.h include from ParsedAttr.h, NFC 2020-03-11 20:47:11 -07:00
ExpandModularHeadersPPCallbacks.h Avoid including FileManager.h from SourceManager.h 2020-03-11 13:53:12 -07:00
GlobList.cpp Refactor GlobList from an ad-hoc linked list to a vector 2019-08-27 10:56:13 +00:00
GlobList.h Refactor GlobList from an ad-hoc linked list to a vector 2019-08-27 10:56:13 +00:00
add_new_check.py [clang-tidy] prevent generated checks from triggering assertions on anonymous functions 2020-08-12 12:43:40 +01:00
clang-tidy-config.h.cmake Add an explicit toggle for the static analyzer in clang-tidy 2020-09-10 10:48:17 -04:00
rename_check.py [clang-tidy] NFC: Cleanup Python scripts 2020-05-18 12:21:27 +02:00