summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/cppcoreguidelines
Commit message (Collapse)AuthorAgeFilesLines
...
* [clang-tidy] getPreviousNonCommentToken -> getPreviousTokenAlexander Kornienko2017-02-061-2/+2
| | | | llvm-svn: 294192
* [clang-tidy] cppcoreguidelines-slicing: display discarded state size in bytesClement Courbet2016-12-221-2/+3
| | | | | | https://reviews.llvm.org/D27212 llvm-svn: 290340
* modernize-use-auto NFC fixesPiotr Padlewski2016-12-142-4/+3
| | | | llvm-svn: 289656
* [Clang-tidy] check for malloc, realloc and free callsAlexander Kornienko2016-12-134-0/+109
| | | | | | | | | | | | | | | | | | | | | | | 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
* [clang-tools-extra] Format sources with clang-format. NFC.Mandeep Singh Grang2016-11-0810-28/+29
| | | | | | | | | | | | | | | | Summary: Ran clang-format on all .c/.cpp/.h files in clang-tools-extra. Excluded the test, unittests, clang-reorder-fields, include-fixer, modularize and pptrace directories. Reviewers: klimek, alexfh Subscribers: nemanjai Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D26329 llvm-svn: 286221
* [clang-tidy] Handle bitfields in cppcoreguidelines-pro-type-member-initMalcolm Parsons2016-11-011-2/+4
| | | | | | | | | | | | | | Summary: Unnamed bitfields cannot be initialized. Bitfields cannot be in-class initialized. Reviewers: alexfh, hokein, aaron.ballman Subscribers: Prazek, nemanjai, cfe-commits Differential Revision: https://reviews.llvm.org/D26119 llvm-svn: 285752
* [clang-tidy] Don't use a SmallSetVector of an enum.Justin Lebar2016-10-212-5/+10
| | | | | | | | | | | | | | | Summary: This doesn't work after converting SmallSetVector to use DenseSet. Instead we can just use a SmallVector. Reviewers: timshen Subscribers: nemanjai, cfe-commits Differential Revision: https://reviews.llvm.org/D25647 llvm-svn: 284873
* [clang-tidy] Fix an assertion failure in cppcoreguidelines-pro-type-member-init.Haojian Wu2016-10-201-0/+5
| | | | | | | | | | | | | | | Summary: The matcher for matching "class with default constructor" still match some classes without default constructor, which trigger an assert at Line 307. This patch makes the matcher more strict. Reviewers: aaron.ballman Subscribers: nemanjai, cfe-commits Differential Revision: https://reviews.llvm.org/D25747 llvm-svn: 284727
* [clang-tidy] Ignore empty members and bases in ↵Malcolm Parsons2016-10-111-1/+24
| | | | | | | | | | | | | | cppcoreguidelines-pro-type-member-init Summary: Empty/incomplete variables/members/bases don't need to be initialized Reviewers: mgehre, aaron.ballman, alexfh Subscribers: nemanjai, cfe-commits Differential Revision: https://reviews.llvm.org/D25238 llvm-svn: 283886
* Fix some false-positives with cppcoreguidelines-pro-type-member-init. Handle ↵Aaron Ballman2016-10-042-35/+62
| | | | | | | | | | classes with default constructors that are defaulted or are not present in the AST. Classes with virtual methods or virtual bases are not trivially default constructible, so their members and bases need to be initialized. Patch by Malcolm Parsons. llvm-svn: 283224
* [clang-tidy] Cleaning up language options.Gabor Horvath2016-09-241-3/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D24881 llvm-svn: 282319
* [clang-tidy] Fix segfault in cppcore-guidelines-special-member-functions checkJonathan Coe2016-08-022-21/+18
| | | | | | | | | | | | | | | | | | | | Summary: Use a set rather than a vector of defined special member functions so that multiple declarations of the same function are only counted once. Move some private static member functions into the cpp file. Run clang-format on header. Reviewers: ericLemanissier, Prazek, aaron.ballman Subscribers: Prazek, cfe-commits, nemanjai Projects: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D23008 llvm-svn: 277523
* [clang-tidy] remove trailing whitespaces and retabKirill Bobyrev2016-08-016-9/+9
| | | | llvm-svn: 277340
* [clang-tidy] add check cppcoreguidelines-special-member-functionsJonathan Coe2016-07-304-0/+238
| | | | | | | | | | | | | | | | | | | Summary: Check for classes that violate the rule of five and zero as specified in CppCoreGuidelines: "If a class defines or deletes a default operation then it should define or delete them all." https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#c21-if-you-define-or-delete-any-default-operation-define-or-delete-them-all. Reviewers: alexfh, sbenza, aaron.ballman Subscribers: Prazek, Eugene.Zelenko, cfe-commits, ericLemanissier, nemanjai Projects: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D22513 llvm-svn: 277262
* Revert "Revert "[clang-tidy] new cppcoreguidelines-slicing""Clement Courbet2016-07-224-0/+184
| | | | | | Second try for r276408 llvm-svn: 276415
* Revert "[clang-tidy] new cppcoreguidelines-slicing"Clement Courbet2016-07-224-184/+0
| | | | | | Tests fail on clang-x64-ninja-win7 due to too narrow expectation. llvm-svn: 276413
* [clang-tidy] new cppcoreguidelines-slicingClement Courbet2016-07-224-0/+184
| | | | | | | | | | | | Flags slicing of member variables or vtable. See: https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#es63-dont-slice https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#c145-access-polymorphic-objects-through-pointers-and-references Differential revision: http://reviews.llvm.org/D21974 llvm-svn: 276408
* cppcoreguidelines-pro-bounds-constant-array-index: ignore implicit constructorMatthias Gehre2016-07-191-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The code struct A { int x[3]; }; gets an compiler-generated copy constructor that uses ArraySubscriptExpr (see below). Previously, the check would generate a warning on that copy constructor. This commit disables the warning on implicitly generated code. AST: |-CXXConstructorDecl 0x337b3c8 <col:8> col:8 implicit used constexpr A 'void (const struct A &) noexcept' inline | |-ParmVarDecl 0x337b510 <col:8> col:8 used 'const struct A &' | |-CXXCtorInitializer Field 0x3379238 'x' 'int [3]' | | `-ImplicitCastExpr 0x337e158 <col:8> 'int' <LValueToRValue> | | `-ArraySubscriptExpr 0x337e130 <col:8> 'const int' lvalue | | |-ImplicitCastExpr 0x337e118 <col:8> 'const int *' <ArrayToPointerDecay> | | | `-MemberExpr 0x337dfc8 <col:8> 'int const[3]' lvalue .x 0x3379238 | | | `-DeclRefExpr 0x337dfa0 <col:8> 'const struct A' lvalue ParmVar 0x337b510 '' 'const struct A &' | | `-ImplicitCastExpr 0x337e098 <col:8> 'unsigned long' <LValueToRValue> | | `-DeclRefExpr 0x337e070 <col:8> 'unsigned long' lvalue Var 0x337e010 '__i0' 'unsigned long' Reviewers: alexfh, aaron.ballman Subscribers: aemerson, nemanjai, cfe-commits Differential Revision: https://reviews.llvm.org/D22381 llvm-svn: 275993
* cppcoreguidelines-pro-bounds-constant-array-index: crash for value dependent ↵Matthias Gehre2016-07-141-0/+4
| | | | | | | | | | | | | | | | | | | | | | index in c++03 mode Summary: When the expression is value dependent, isIntegerConstantExpr() crashes in C++03 mode with ../tools/clang/lib/AST/ExprConstant.cpp:9330: (anonymous namespace)::ICEDiag CheckICE(const clang::Expr *, const clang::ASTContext &): Assertion `!E->isValueDependent() && "Should not see value dependent exprs!"' failed. In C++11 mode, that assert does not trigger. This commit works around this in the check. We don't check value-dependent indices and instead check their specialization. Reviewers: alexfh, aaron.ballman Subscribers: nemanjai, cfe-commits Differential Revision: http://reviews.llvm.org/D22190 llvm-svn: 275461
* Fixed cppcoreguidelines-pro-type-member-init when checking records with ↵Haojian Wu2016-05-101-32/+30
| | | | | | | | | | | | | | | | | | indirect fields Summary: Fixed a crash in cppcoreguidelines-pro-type-member-init when checking record types with indirect fields pre-C++11. Fixed handling of indirect fields so they are properly checked and suggested fixes are proposed. Patch by Michael Miller! Reviewers: aaron.ballman, alexfh, hokein Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D19993 llvm-svn: 269024
* [clang-tidy] New: checker misc-unconventional-assign-operator replacing ↵Gabor Horvath2016-05-041-2/+2
| | | | | | | | | | | | | | misc-assign-operator-signature Summary: Finds return statements in assign operator bodies where the return value is different from '*this'. Only assignment operators with correct return value Class& are checked. Reviewers: aaron.ballman, alexfh, sbenza Subscribers: o.gyorgy, baloghadamsoftware, LegalizeAdulthood, aaron.ballman, Eugene.Zelenko, xazax.hun, cfe-commits Differential Revision: http://reviews.llvm.org/D18265 llvm-svn: 268492
* Fix a crash in cppcoreguidelines-pro-type-member-init when checking a class ↵Haojian Wu2016-05-031-2/+2
| | | | | | | | | | | | | | | | that initializes itself as a base Summary: Fix a crash when a record type initializes itself in its own base class initializer list. Patch by Michael Miller! Reviewers: alexfh, aaron.ballman, hokein Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D19802 llvm-svn: 268369
* [clang-tidy] Cleanup namespace in utils folder.Etienne Bergeron2016-05-033-9/+10
| | | | | | | | | | | | | | Summary: This is a step forward cleaning up the namespaces in clang-tidy/utils. There is no behavior change. Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D19819 llvm-svn: 268356
* [clang-tidy] ProTypeMemberInitCheck - check that field decls do not have ↵Felix Berger2016-05-031-0/+2
| | | | | | | | | | | | in-class initializer. Reviewers: alexfh, JVApen, aaron.ballman Subscribers: flx, aaron.ballman, cfe-commits Differential Revision: http://reviews.llvm.org/D18300 llvm-svn: 268352
* [clang-tidy] Cleaning namespaces to be more consistant across checkers.Etienne Bergeron2016-05-0218-5/+41
| | | | | | | | | | | | | | Summary: The goal of the patch is to bring checkers in their appropriate namespace. This path doesn't change any behavior. Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D19811 llvm-svn: 268264
* [clang-tidy] cppcoreguidelines-pro-type-member-init should not complain ↵Alexander Kornienko2016-04-281-0/+1
| | | | | | | | | | | | | | | | about static variables Summary: Variables with static storage duration are zero-initialized per [stmt.dcl]p4 and [basic.start.init]p2. Reviewers: sbenza, aaron.ballman Subscribers: michael_miller, flx, cfe-commits Differential Revision: http://reviews.llvm.org/D19672 llvm-svn: 267933
* Fix a crash in cppcoreguidelines-pro-type-member-init when checking a type ↵Haojian Wu2016-04-271-2/+6
| | | | | | | | | | | | | | | | with a template parameter as a base class. Summary: Fixed a crash in cppcoreguidelines-pro-type-member-init when encountering a type that uses one of its template parameters as a base when compiling for C++98. Patch by Michael Miller! Reviewers: aaron.ballman, alexfh, hokein Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D19539 llvm-svn: 267700
* clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp: Use ↵NAKAMURA Takumi2016-04-231-1/+1
| | | | | | raw_string_ostream::str() to flush the buffer explicitly. llvm-svn: 267290
* Fix a crash in cppcoreguidelines-pro-type-member-init related to missing ↵Haojian Wu2016-04-201-6/+4
| | | | | | | | | | | | | | | | constructor bodies. Summary: Fixes a crash in cppcoreguidelines-pro-type-member-init when checking some record types with a constructor without a body. We now check to make sure the constructor has a body before looking for missing members and base initializers. Patch by Michael Miller! Reviewers: aaron.ballman, alexfh, hokein Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D19270 llvm-svn: 266862
* [Clang-tidy] Fix extra semicolon warning in ↵Eugene Zelenko2016-04-191-2/+2
| | | | | | cppcoreguidelines/ProTypeMemberInitCheck.cpp. llvm-svn: 266795
* Complete support for C++ Core Guidelines Type.6: Always initialize a member ↵Alexander Kornienko2016-04-132-138/+355
| | | | | | | | | | | | | | | | variable. Summary: Added the remaining features needed to satisfy C++ Core Guideline Type.6: Always initialize a member variable to cppcoreguidelines-pro-type-member-init. The check now flags all default-constructed uses of record types without user-provided default constructors that would leave their memory in an undefined state. The check suggests value initializing them instead. Reviewers: flx, alexfh, aaron.ballman Subscribers: klimek, aaron.ballman, LegalizeAdulthood, cfe-commits Patch by Michael Miller! Differential Revision: http://reviews.llvm.org/D18584 llvm-svn: 266191
* [clang-tidy] cppcoreguidelines-interfaces-global-initAlexander Kornienko2016-04-084-0/+98
| | | | | | | | | | | | | | | | Summary: This check flags initializers of globals that access extern objects, and therefore can lead to order-of-initialization problems (this recommandation is part of CPP core guidelines). Note that this only checks half of the guideline for now (it does not enforce using constexpr functions). Reviewers: aaron.ballman, alexfh Subscribers: aaron.ballman, etienneb, Eugene.Zelenko, cfe-commits Patch by Clement Courbet! Differential Revision: http://reviews.llvm.org/D18649 llvm-svn: 265774
* Fix crashes from delayed template parsing code that assumed getBody() would ↵Aaron Ballman2016-03-221-2/+7
| | | | | | | | return non-null. Patch by Etienne Bergeron. llvm-svn: 264049
* [clang-tidy] Update check for API change in r263895.Benjamin Kramer2016-03-201-2/+4
| | | | | | | for range stmts now have split begin and ends, just apply OR to the condition. Should unbreak the build. llvm-svn: 263900
* [clang-tidy] ClangTidy check to flag uninitialized builtin and pointer fields.Felix Berger2016-02-154-0/+278
| | | | | | | | | | | | | | | | | | | | | Summary: This patch is a continuation of http://reviews.llvm.org/D10553 by Jonathan B Coe. The main additions are: 1. For C++11 the check suggests in-class field initialization as fix. This makes the fields future proof towards the addition of new constructors. 2 For older language versions the fields are added in the right position in the initializer list with more tests. 3. User documentation. Reviewers: alexfh, jbcoe Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D16517 llvm-svn: 260873
* Remove autoconf supportChris Bieneman2016-01-261-12/+0
| | | | | | | | | | | | | | | | Summary: This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html "Now I am become Death, the destroyer of worlds." -J. Robert Oppenheimer Reviewers: chandlerc, grosbach, bob.wilson, echristo Subscribers: cfe-commits, klimek Differential Revision: http://reviews.llvm.org/D16475 llvm-svn: 258864
* [clang-tidy] add check cppcoreguidelines-pro-bounds-constant-array-indexMatthias Gehre2015-12-134-0/+176
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This is http://reviews.llvm.org/D13746 but instead of including <array>, a stub is provided. This check flags all array subscriptions on static arrays and std::arrays that either have a non-compile-time-constant index or are out of bounds. Dynamic accesses into arrays are difficult for both tools and humans to validate as safe. array_view is a bounds-checked, safe type for accessing arrays of data. at() is another alternative that ensures single accesses are bounds-checked. If iterators are needed to access an array, use the iterators from an array_view constructed over the array. This rule is part of the "Bounds safety" profile of the C++ Core Guidelines, see https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#-bounds2-only-index-into-arrays-using-constant-expressions Reviewers: alexfh, sbenza, bkramer, aaron.ballman Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D15030 llvm-svn: 255470
* [clang-tidy] cppcoreguidelines-pro-bounds-pointer-arithmetic: ignore ↵Matthias Gehre2015-11-261-5/+9
| | | | | | | | | | | | | | | | generated pointer arithmetic Summary: Inside a range-based for-loop over an array, the compiler generates pointer arithmetic (end = array + size). Don't flag this. Reviewers: alexfh, sbenza, bkramer, aaron.ballman Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D14582 llvm-svn: 254182
* Revert r253401, "[clang-tidy] add check ↵NAKAMURA Takumi2015-11-184-175/+0
| | | | | | | | cppcoreguidelines-pro-bounds-constant-array-index" cppcoreguidelines-pro-bounds-constant-array-index.cpp is failing in several hosts. llvm-svn: 253428
* [clang-tidy] add check cppcoreguidelines-pro-bounds-constant-array-indexMatthias Gehre2015-11-174-0/+175
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: This check flags all array subscriptions on static arrays and std::arrays that either have a non-compile-time-constant index or are out of bounds. Dynamic accesses into arrays are difficult for both tools and humans to validate as safe. array_view is a bounds-checked, safe type for accessing arrays of data. at() is another alternative that ensures single accesses are bounds-checked. If iterators are needed to access an array, use the iterators from an array_view constructed over the array. This rule is part of the "Bounds safety" profile of the C++ Core Guidelines, see https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#-bounds2-only-index-into-arrays-using-constant-expressions Reviewers: alexfh, sbenza, bkramer, aaron.ballman Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D13746 llvm-svn: 253401
* Fix bug 25362 "cppcoreguidelines-pro-bounds-array-to-pointer-decay does not ↵Matthias Gehre2015-11-172-2/+17
| | | | | | | | | | | | | | | | | | | | | | | | | consider const" Summary: The current matcher is implicitCastExpr(unless(hasParent(explicitCastExpr()))) but the AST in the bug is `-CXXStaticCastExpr 0x2bb64f8 <col:21, col:55> 'void *const *' static_cast<void *const *> <NoOp> `-ImplicitCastExpr 0x2bb64e0 <col:47> 'void *const *' <NoOp> `-ImplicitCastExpr 0x2bb64c8 <col:47> 'void **' <ArrayToPointerDecay> `-DeclRefExpr 0x2bb6458 <col:47> 'void *[2]' lvalue Var 0x2bb59d0 'addrlist' 'void *[2]' i.e. an ImplicitCastExpr (const cast) between decay and explicit cast. Reviewers: alexfh, sbenza, bkramer, aaron.ballman Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D14517 llvm-svn: 253399
* [clang-tidy] add new check cppcoreguidelines-pro-type-cstyle-castMatthias Gehre2015-11-084-0/+145
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [clang-tidy] Add new check cppcoreguidelines-pro-bounds-array-to-pointer-decayMatthias Gehre2015-10-264-0/+98
| | | | | | | | | | | | | | | | | | | | Summary: This check flags all array to pointer decays. Pointers should not be used as arrays. array_view is a bounds-checked, safe alternative to using pointers to access arrays. This rule is part of the "Bounds safety" profile of the C++ Core Guidelines, see https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#-bounds3-no-array-to-pointer-decay Reviewers: alexfh, sbenza, bkramer, aaron.ballman Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D13640 llvm-svn: 251358
* [clang-tidy] add check cppcoreguidelines-pro-type-varargMatthias Gehre2015-10-214-4/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This check flags all calls to c-style vararg functions and all use of va_list, va_start and va_arg. Passing to varargs assumes the correct type will be read. This is fragile because it cannot generally be enforced to be safe in the language and so relies on programmer discipline to get it right. This rule is part of the "Type safety" profile of the C++ Core Guidelines, see https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#-type8-avoid-reading-from-varargs-or-passing-vararg-arguments-prefer-variadic-template-parameters-instead This commits also reverts "[clang-tidy] add cert's VariadicFunctionDefCheck as cppcoreguidelines-pro-type-vararg-def" because that check makes the SFINAE use of vararg functions impossible. Reviewers: alexfh, sbenza, bkramer, aaron.ballman Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D13787 llvm-svn: 250939
* [clang-tidy] add check cppcoreguidelines-pro-type-union-accessMatthias Gehre2015-10-164-0/+72
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This check flags all access to members of unions. Passing unions as a whole is not flagged. Reading from a union member assumes that member was the last one written, and writing to a union member assumes another member with a nontrivial destructor had its destructor called. This is fragile because it cannot generally be enforced to be safe in the language and so relies on programmer discipline to get it right. This rule is part of the "Type safety" profile of the C++ Core Guidelines, see https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#-type7-avoid-accessing-members-of-raw-unions-prefer-variant-instead Reviewers: alexfh, sbenza, bkramer, aaron.ballman Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D13784 llvm-svn: 250537
* [clang-tidy] add cert's VariadicFunctionDefCheck as ↵Matthias Gehre2015-10-152-0/+4
| | | | | | | | | | | | | | | | | cppcoreguidelines-pro-type-vararg-def Summary: Import the cert check for variadic function definitions into cppcoreguidelines module to check part of https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#-type8-avoid-reading-from-varargs-or-passing-vararg-arguments-prefer-variadic-template-parameters-instead Reviewers: alexfh, sbenza, bkramer, aaron.ballman Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D13785 llvm-svn: 250468
* Appeasing build bots by linking in the proper libraries.Aaron Ballman2015-10-131-0/+1
| | | | llvm-svn: 250166
* Expose the clang-tidy misc-assign-operator-signature checker as ↵Aaron Ballman2015-10-131-0/+3
| | | | | | cppcoreguidelines-c-copy-assignment-signature. llvm-svn: 250165
* [clang-tidy] new check cppcoreguidelines-pro-bounds-pointer-arithmeticMatthias Gehre2015-10-124-0/+91
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This check flags all usage of pointer arithmetic, because it could lead to an invalid pointer. Subtraction of two pointers is not flagged by this check. Pointers should only refer to single objects, and pointer arithmetic is fragile and easy to get wrong. array_view is a bounds-checked, safe type for accessing arrays of data. This rule is part of the "Bounds safety" profile of the C++ Core Guidelines, see https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#-bounds1-dont-use-pointer-arithmetic-use-array_view-instead Depends on D13313 Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D13311 llvm-svn: 250116
* [clang-tidy] add check cppcoreguidelines-pro-type-static-cast-downcastMatthias Gehre2015-10-124-0/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This check flags all usages of static_cast, where a base class is casted to a derived class. In those cases, a fixit is provided to convert the cast to a dynamic_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. This rule is part of the "Type safety" profile of the C++ Core Guidelines, see https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#-type2-dont-use-static_cast-downcasts-use-dynamic_cast-instead Depends on D13313 Reviewers: alexfh, sbenza, bkramer, aaron.ballman Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D13368 llvm-svn: 250098
OpenPOWER on IntegriCloud