2020-04-08 00:26:40 +08:00
|
|
|
set(LLVM_LINK_COMPONENTS
|
|
|
|
FrontendOpenMP
|
|
|
|
Support
|
|
|
|
)
|
2015-10-06 21:31:00 +08:00
|
|
|
|
|
|
|
add_clang_library(clangTidyCppCoreGuidelinesModule
|
[clang-tidy] implement check for goto
The usage of `goto` is discourage in C++ since forever. This check implements
a warning for every `goto`. Even though there are (rare) valid use cases for
`goto`, better high level constructs should be used.
`goto` is used sometimes in C programs to free resources at the end of
functions in the case of errors. This pattern is better implemented with
RAII in C++.
Reviewers: aaron.ballman, alexfh, hokein
Reviewed By: aaron.ballman
Subscribers: lebedev.ri, jbcoe, Eugene.Zelenko, klimek, nemanjai, mgorny, xazax.hun, kbarton, cfe-commits
Differential Revision: https://reviews.llvm.org/D41815
llvm-svn: 322626
2018-01-17 18:27:41 +08:00
|
|
|
AvoidGotoCheck.cpp
|
2020-03-13 22:05:13 +08:00
|
|
|
AvoidNonConstGlobalVariablesCheck.cpp
|
2015-10-06 21:31:00 +08:00
|
|
|
CppCoreGuidelinesTidyModule.cpp
|
2019-10-03 01:18:57 +08:00
|
|
|
InitVariablesCheck.cpp
|
2016-04-08 17:51:06 +08:00
|
|
|
InterfacesGlobalInitCheck.cpp
|
[clang-tidy] implement cppcoreguidelines macro rules
Summary:
In short macros are discouraged by multiple rules (and sometimes reference randomly). [Enum.1], [ES.30], [ES.31]
This check allows only headerguards and empty macros for annotation.
Reviewers: aaron.ballman, hokein
Reviewed By: aaron.ballman
Subscribers: jbcoe, Eugene.Zelenko, klimek, nemanjai, mgorny, xazax.hun, kbarton, cfe-commits
Differential Revision: https://reviews.llvm.org/D41648
llvm-svn: 344940
2018-10-23 03:20:01 +08:00
|
|
|
MacroUsageCheck.cpp
|
2018-05-23 15:58:41 +08:00
|
|
|
NarrowingConversionsCheck.cpp
|
[Clang-tidy] check for malloc, realloc and free calls
Summary:
This checker flags the use of C-style memory management functionality and notes about modern alternatives.
In an earlier revision it tried to autofix some kind of patterns, but that was a bad idea. Since memory management can be so widespread in a program, manual updating is most likely necessary.
Maybe for special cases, there could be later additions to this basic checker.
This is the first checker I wrote and I never did something with clang (only compiling programs). So whenever I missed conventions or did plain retarded stuff, feel free to point it out! I am willing to fix them and write a better checker.
I hope the patch does work, I never did this either. On a testapply in my repository it did, but I am pretty unconfident in my patching skills :)
Reviewers: aaron.ballman, hokein, alexfh, malcolm.parsons
Subscribers: cfe-commits, JDevlieghere, nemanjai, Eugene.Zelenko, Prazek, mgorny, modocache
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D26167
Patch by Jonas Toth!
llvm-svn: 289546
2016-12-14 00:38:18 +08:00
|
|
|
NoMallocCheck.cpp
|
2017-09-13 04:00:42 +08:00
|
|
|
OwningMemoryCheck.cpp
|
2015-10-27 05:56:02 +08:00
|
|
|
ProBoundsArrayToPointerDecayCheck.cpp
|
2015-12-14 06:08:26 +08:00
|
|
|
ProBoundsConstantArrayIndexCheck.cpp
|
2015-10-13 05:53:19 +08:00
|
|
|
ProBoundsPointerArithmeticCheck.cpp
|
2015-10-07 20:24:57 +08:00
|
|
|
ProTypeConstCastCheck.cpp
|
[clang-tidy] add new check cppcoreguidelines-pro-type-cstyle-cast
Summary:
This check flags all use of c-style casts that perform a static_cast
downcast, const_cast, or reinterpret_cast.
Use of these casts can violate type safety and cause the program to
access a
variable that is actually of type X to be accessed as if it were of an
unrelated type Z. Note that a C-style (T)expression cast means to
perform
the first of the following that is possible: a const_cast, a
static_cast, a
static_cast followed by a const_cast, a reinterpret_cast, or a
reinterpret_cast followed by a const_cast. This rule bans (T)expression
only when used to perform an unsafe cast.
This rule is part of the "Type safety" profile of the C++ Core
Guidelines, see
https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#-type4-dont-use-c-style-texpression-casts-that-would-perform-a-static_cast-downcast-const_cast-or-reinterpret_cast.
Reviewers: alexfh, sbenza, bkramer, aaron.ballman
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D14096
llvm-svn: 252425
2015-11-09 05:10:39 +08:00
|
|
|
ProTypeCstyleCastCheck.cpp
|
2016-02-15 12:27:56 +08:00
|
|
|
ProTypeMemberInitCheck.cpp
|
2015-10-06 21:31:00 +08:00
|
|
|
ProTypeReinterpretCastCheck.cpp
|
2015-10-13 04:46:53 +08:00
|
|
|
ProTypeStaticCastDowncastCheck.cpp
|
2015-10-17 02:46:30 +08:00
|
|
|
ProTypeUnionAccessCheck.cpp
|
2015-10-22 04:09:02 +08:00
|
|
|
ProTypeVarargCheck.cpp
|
2016-07-22 21:45:00 +08:00
|
|
|
SlicingCheck.cpp
|
2018-09-20 08:02:55 +08:00
|
|
|
SpecialMemberFunctionsCheck.cpp
|
2015-10-06 21:31:00 +08:00
|
|
|
|
|
|
|
LINK_LIBS
|
|
|
|
clangAST
|
|
|
|
clangASTMatchers
|
|
|
|
clangBasic
|
|
|
|
clangLex
|
2018-12-12 16:25:16 +08:00
|
|
|
clangSerialization
|
2015-10-06 21:31:00 +08:00
|
|
|
clangTidy
|
2015-10-13 23:42:06 +08:00
|
|
|
clangTidyMiscModule
|
[clang-tidy] Avoid C arrays check
Summary:
[[ https://bugs.llvm.org/show_bug.cgi?id=39224 | PR39224 ]]
As discussed, we can't always do the transform automatically due to that array-to-pointer decay of C array.
In order to detect whether we can do said transform, we'd need to be able to see all usages of said array,
which is, i would say, rather impossible if e.g. it is in the header.
Thus right now no fixit exists.
Exceptions: `extern "C"` code.
References:
* [[ https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#es27-use-stdarray-or-stack_array-for-arrays-on-the-stack | CPPCG ES.27: Use std::array or stack_array for arrays on the stack ]]
* [[ https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#slcon1-prefer-using-stl-array-or-vector-instead-of-a-c-array | CPPCG SL.con.1: Prefer using STL array or vector instead of a C array ]]
* HICPP `4.1.1 Ensure that a function argument does not undergo an array-to-pointer conversion`
* MISRA `5-2-12 An identifier with array type passed as a function argument shall not decay to a pointer`
Reviewers: aaron.ballman, JonasToth, alexfh, hokein, xazax.hun
Reviewed By: JonasToth
Subscribers: Eugene.Zelenko, mgorny, rnkovacs, cfe-commits
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D53771
llvm-svn: 346835
2018-11-14 17:01:08 +08:00
|
|
|
clangTidyModernizeModule
|
2018-08-12 22:47:16 +08:00
|
|
|
clangTidyReadabilityModule
|
2015-10-06 21:31:00 +08:00
|
|
|
clangTidyUtils
|
|
|
|
clangTooling
|
|
|
|
)
|