2013-07-29 16:19:24 +08:00
|
|
|
set(LLVM_LINK_COMPONENTS
|
2020-04-08 00:26:40 +08:00
|
|
|
FrontendOpenMP
|
2013-12-10 03:27:57 +08:00
|
|
|
Support
|
2013-07-29 16:19:24 +08:00
|
|
|
)
|
|
|
|
|
2020-09-04 07:37:29 +08:00
|
|
|
configure_file(
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/clang-tidy-config.h.cmake
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/clang-tidy-config.h)
|
|
|
|
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
|
2013-07-29 16:19:24 +08:00
|
|
|
add_clang_library(clangTidy
|
|
|
|
ClangTidy.cpp
|
2019-03-25 20:36:30 +08:00
|
|
|
ClangTidyCheck.cpp
|
2013-07-29 16:19:24 +08:00
|
|
|
ClangTidyModule.cpp
|
2014-01-10 00:31:25 +08:00
|
|
|
ClangTidyDiagnosticConsumer.cpp
|
2014-05-23 00:07:11 +08:00
|
|
|
ClangTidyOptions.cpp
|
[clang-tidy] Profile is a per-AST (per-TU) data.
Summary:
As discussed in D45931, currently, profiling output of clang-tidy is somewhat not great.
It outputs one profile at the end of the execution, and that profile contains the data
from the last TU that was processed. So if the tool run on multiple TU's, the data is
not accumulated, it is simply discarded.
It would be nice to improve this.
This differential is the first step - make this profiling info per-TU,
and output it after the tool has finished processing each TU.
In particular, when `ClangTidyASTConsumer` destructor runs.
Next step will be to add a CSV (JSON?) printer to store said profiles under user-specified directory prefix.
Reviewers: alexfh, sbenza
Reviewed By: alexfh
Subscribers: Eugene.Zelenko, mgorny, xazax.hun, mgrang, klimek, cfe-commits
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D46504
llvm-svn: 331763
2018-05-08 21:14:21 +08:00
|
|
|
ClangTidyProfiling.cpp
|
2019-03-22 21:42:48 +08:00
|
|
|
ExpandModularHeadersPPCallbacks.cpp
|
2019-08-26 23:44:32 +08:00
|
|
|
GlobList.cpp
|
2014-02-23 21:43:01 +08:00
|
|
|
|
|
|
|
DEPENDS
|
|
|
|
ClangSACheckers
|
2020-06-23 23:48:04 +08:00
|
|
|
omp_gen
|
2020-06-17 02:43:55 +08:00
|
|
|
)
|
2014-02-26 14:41:29 +08:00
|
|
|
|
2020-06-17 02:43:55 +08:00
|
|
|
clang_target_link_libraries(clangTidy
|
|
|
|
PRIVATE
|
2019-09-12 11:10:57 +08:00
|
|
|
clangAnalysis
|
2013-12-10 09:41:10 +08:00
|
|
|
clangAST
|
|
|
|
clangASTMatchers
|
2013-07-29 16:19:24 +08:00
|
|
|
clangBasic
|
2016-10-18 01:25:02 +08:00
|
|
|
clangFormat
|
2013-12-10 09:41:10 +08:00
|
|
|
clangFrontend
|
2015-08-11 21:11:29 +08:00
|
|
|
clangLex
|
2014-07-17 00:50:17 +08:00
|
|
|
clangRewrite
|
2014-07-14 13:01:53 +08:00
|
|
|
clangSema
|
2018-12-12 16:25:16 +08:00
|
|
|
clangSerialization
|
2013-12-10 09:41:10 +08:00
|
|
|
clangTooling
|
2014-10-30 08:44:01 +08:00
|
|
|
clangToolingCore
|
2013-07-29 16:19:24 +08:00
|
|
|
)
|
|
|
|
|
2020-09-04 07:37:29 +08:00
|
|
|
if(CLANG_TIDY_ENABLE_STATIC_ANALYZER)
|
2020-06-17 02:43:55 +08:00
|
|
|
clang_target_link_libraries(clangTidy
|
|
|
|
PRIVATE
|
2018-10-02 04:24:22 +08:00
|
|
|
clangStaticAnalyzerCore
|
|
|
|
clangStaticAnalyzerFrontend
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2019-09-27 20:56:14 +08:00
|
|
|
# Checks.
|
|
|
|
# If you add a check, also add it to ClangTidyForceLinker.h in this directory.
|
[clang-tidy][Part1] Add a new module Android and three new checks.
Summary:
A common source of security bugs is code that opens a file descriptors without using the O_CLOEXEC flag. (Without that flag, an opened sensitive file would remain open across a fork+exec to a lower-privileged SELinux domain, leaking that sensitive data.).
Add a new Android module and one checks in clang-tidy.
-- open(), openat(), and open64() should include O_CLOEXEC in their flags argument. [android-file-open-flag]
Links to part2 and part3:
https://reviews.llvm.org/D33745
https://reviews.llvm.org/D33747
Reviewers: chh, alexfh, aaron.ballman, hokein
Reviewed By: alexfh, hokein
Subscribers: jbcoe, joerg, malcolm.parsons, Eugene.Zelenko, srhines, mgorny, xazax.hun, cfe-commits, krytarowski
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D33304
llvm-svn: 306165
2017-06-24 05:37:29 +08:00
|
|
|
add_subdirectory(android)
|
2018-03-09 18:47:14 +08:00
|
|
|
add_subdirectory(abseil)
|
2020-09-08 21:35:14 +08:00
|
|
|
add_subdirectory(altera)
|
2016-04-30 01:58:29 +08:00
|
|
|
add_subdirectory(boost)
|
2017-07-14 20:15:55 +08:00
|
|
|
add_subdirectory(bugprone)
|
2015-10-02 21:27:19 +08:00
|
|
|
add_subdirectory(cert)
|
2020-11-30 17:15:01 +08:00
|
|
|
add_subdirectory(concurrency)
|
2015-10-06 21:31:00 +08:00
|
|
|
add_subdirectory(cppcoreguidelines)
|
[clang-tidy] New check to warn when storing dispatch_once_t in non-static, non-global storage.
Summary:
Creates a new darwin ClangTidy module and adds the darwin-dispatch-once-nonstatic check that warns about dispatch_once_t variables not in static or global storage. This catches a missing static for local variables in e.g. singleton initialization behavior, and also warns on storing dispatch_once_t values in Objective-C instance variables. C/C++ struct/class instances may potentially live in static/global storage, and are ignored for this check.
The osx.API static analysis checker can find the non-static storage use of dispatch_once_t; I thought it useful to also catch this issue in clang-tidy when possible.
This is a re-land of https://reviews.llvm.org/D67567
Reviewers: thakis, gribozavr, stephanemoore
Subscribers: Eugene.Zelenko, mgorny, xazax.hun, jkorous, arphaman, kadircet, usaxena95
Tags: #clang-tools-extra, #clang, #llvm
Differential Revision: https://reviews.llvm.org/D68109
llvm-svn: 373065
2019-09-27 18:49:12 +08:00
|
|
|
add_subdirectory(darwin)
|
2017-11-29 05:09:25 +08:00
|
|
|
add_subdirectory(fuchsia)
|
2013-07-29 16:19:24 +08:00
|
|
|
add_subdirectory(google)
|
2017-03-20 01:23:23 +08:00
|
|
|
add_subdirectory(hicpp)
|
[clang-tidy] Add a module for the Linux kernel.
Summary:
Now that clang is going to be able to build the Linux kernel again on
x86, and we have gen_compile_commands.py upstream for generating
compile_commands.json, clang-tidy can be used on the Linux kernel
source.
To that end, this commit adds a new clang-tidy module to be used for
checks specific to Linux kernel source. The Linux kernel follows its own
style of C, and it will be useful to separate those checks into their
own module.
This also adds an initial check that makes sure that return values from
the kernel error functions like PTR_ERR and ERR_PTR are checked. It also
makes sure that any functions that directly return values from these
functions are checked.
Subscribers: xazax.hun, gribozavr, Eugene.Zelenko, lebedev.ri, mgorny, jdoerfert, cfe-commits
Tags: #clang, #clang-tools-extra
Reviewers: aaron.ballman, alexfh, hokein, JonasToth
Differential Revision: https://reviews.llvm.org/D59963
llvm-svn: 367071
2019-07-26 06:32:50 +08:00
|
|
|
add_subdirectory(linuxkernel)
|
2017-03-20 01:23:23 +08:00
|
|
|
add_subdirectory(llvm)
|
[clang-tidy] Add module for llvm-libc and restrict-system-libc-header-check.
Summary: This adds a new module to enforce standards specific to the llvm-libc project. This change also adds the first check which restricts user from including system libc headers accidentally which can lead to subtle bugs that would be a challenge to detect.
Reviewers: alexfh, hokein, aaron.ballman
Reviewed By: aaron.ballman
Subscribers: juliehockett, arphaman, jfb, abrachet, sivachandra, Eugene.Zelenko, njames93, mgorny, xazax.hun, MaskRay, cfe-commits
Tags: #clang-tools-extra, #libc-project, #clang
Differential Revision: https://reviews.llvm.org/D75332
2020-03-13 02:38:05 +08:00
|
|
|
add_subdirectory(llvmlibc)
|
2014-03-05 21:14:32 +08:00
|
|
|
add_subdirectory(misc)
|
2015-08-14 21:17:11 +08:00
|
|
|
add_subdirectory(modernize)
|
2020-09-04 07:37:29 +08:00
|
|
|
if(CLANG_TIDY_ENABLE_STATIC_ANALYZER)
|
2018-10-02 04:24:22 +08:00
|
|
|
add_subdirectory(mpi)
|
|
|
|
endif()
|
2017-10-26 16:23:20 +08:00
|
|
|
add_subdirectory(objc)
|
[clang-tidy] A new OpenMP module
Summary:
Just the empty skeleton.
Previously reviewed as part of D57113.
Reviewers: JonasToth, aaron.ballman, alexfh, xazax.hun, hokein, gribozavr
Reviewed By: JonasToth, gribozavr
Subscribers: jdoerfert, mgorny, rnkovacs, guansong, arphaman, cfe-commits
Tags: #clang-tools-extra, #openmp, #clang
Differential Revision: https://reviews.llvm.org/D57571
llvm-svn: 356800
2019-03-23 03:46:01 +08:00
|
|
|
add_subdirectory(openmp)
|
2015-12-30 18:24:40 +08:00
|
|
|
add_subdirectory(performance)
|
2018-03-08 00:57:42 +08:00
|
|
|
add_subdirectory(portability)
|
2014-09-22 18:41:39 +08:00
|
|
|
add_subdirectory(readability)
|
2019-09-27 20:56:14 +08:00
|
|
|
add_subdirectory(zircon)
|
|
|
|
set(ALL_CLANG_TIDY_CHECKS
|
|
|
|
clangTidyAndroidModule
|
|
|
|
clangTidyAbseilModule
|
2020-09-08 21:35:14 +08:00
|
|
|
clangTidyAlteraModule
|
2019-09-27 20:56:14 +08:00
|
|
|
clangTidyBoostModule
|
|
|
|
clangTidyBugproneModule
|
|
|
|
clangTidyCERTModule
|
2020-11-30 17:15:01 +08:00
|
|
|
clangTidyConcurrencyModule
|
2019-09-27 20:56:14 +08:00
|
|
|
clangTidyCppCoreGuidelinesModule
|
|
|
|
clangTidyDarwinModule
|
|
|
|
clangTidyFuchsiaModule
|
|
|
|
clangTidyGoogleModule
|
|
|
|
clangTidyHICPPModule
|
|
|
|
clangTidyLinuxKernelModule
|
|
|
|
clangTidyLLVMModule
|
[clang-tidy] Add module for llvm-libc and restrict-system-libc-header-check.
Summary: This adds a new module to enforce standards specific to the llvm-libc project. This change also adds the first check which restricts user from including system libc headers accidentally which can lead to subtle bugs that would be a challenge to detect.
Reviewers: alexfh, hokein, aaron.ballman
Reviewed By: aaron.ballman
Subscribers: juliehockett, arphaman, jfb, abrachet, sivachandra, Eugene.Zelenko, njames93, mgorny, xazax.hun, MaskRay, cfe-commits
Tags: #clang-tools-extra, #libc-project, #clang
Differential Revision: https://reviews.llvm.org/D75332
2020-03-13 02:38:05 +08:00
|
|
|
clangTidyLLVMLibcModule
|
2019-09-27 20:56:14 +08:00
|
|
|
clangTidyMiscModule
|
|
|
|
clangTidyModernizeModule
|
|
|
|
clangTidyObjCModule
|
|
|
|
clangTidyOpenMPModule
|
|
|
|
clangTidyPerformanceModule
|
|
|
|
clangTidyPortabilityModule
|
|
|
|
clangTidyReadabilityModule
|
|
|
|
clangTidyZirconModule
|
|
|
|
)
|
2020-09-04 07:37:29 +08:00
|
|
|
if(CLANG_TIDY_ENABLE_STATIC_ANALYZER)
|
2019-09-27 20:56:14 +08:00
|
|
|
list(APPEND ALL_CLANG_TIDY_CHECKS clangTidyMPIModule)
|
|
|
|
endif()
|
|
|
|
set(ALL_CLANG_TIDY_CHECKS ${ALL_CLANG_TIDY_CHECKS} PARENT_SCOPE)
|
|
|
|
|
|
|
|
# Other subtargets. These may reference ALL_CLANG_TIDY_CHECKS
|
|
|
|
# and must be below its definition.
|
|
|
|
add_subdirectory(plugin)
|
2017-03-20 01:23:23 +08:00
|
|
|
add_subdirectory(tool)
|
2014-08-13 21:57:57 +08:00
|
|
|
add_subdirectory(utils)
|
2020-01-24 07:57:45 +08:00
|
|
|
|
|
|
|
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
|
|
|
|
install(DIRECTORY .
|
2022-01-16 13:48:30 +08:00
|
|
|
DESTINATION include/clang-tidy
|
2020-01-24 07:57:45 +08:00
|
|
|
COMPONENT clang-tidy-headers
|
|
|
|
FILES_MATCHING
|
|
|
|
PATTERN "*.h"
|
|
|
|
)
|
|
|
|
add_custom_target(clang-tidy-headers)
|
|
|
|
set_target_properties(clang-tidy-headers PROPERTIES FOLDER "Misc")
|
|
|
|
if(NOT LLVM_ENABLE_IDE)
|
|
|
|
add_llvm_install_targets(install-clang-tidy-headers
|
|
|
|
DEPENDS clang-tidy-headers
|
|
|
|
COMPONENT clang-tidy-headers)
|
|
|
|
endif()
|
|
|
|
endif()
|