summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/docs/clang-tidy
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert "MPITypeMismatchCheck for Clang-Tidy"Alexander Kornienko2016-07-252-20/+0
| | | | | | This reverts commit r276640. Breaks multiple buildbots. llvm-svn: 276651
* MPITypeMismatchCheck for Clang-TidyAlexander Kornienko2016-07-252-0/+20
| | | | | | | | | | | | | | | | | | | | | | Summary: This check verifies if buffer type and MPI (Message Passing Interface) datatype pairs match. All MPI datatypes defined by the MPI standard (3.1) are verified by this check. User defined typedefs, custom MPI datatypes and null pointer constants are skipped, in the course of verification. Instructions on how to apply the check can be found at: https://github.com/0ax1/MPI-Checker/tree/master/examples Reviewers: alexfh Subscribers: cfe-commits Projects: #clang-tools-extra Patch by Alexander Droste! Differential Revision: https://reviews.llvm.org/D21962 llvm-svn: 276640
* Revert "Revert "[clang-tidy] new cppcoreguidelines-slicing""Clement Courbet2016-07-221-0/+23
| | | | | | Second try for r276408 llvm-svn: 276415
* Revert "[clang-tidy] new cppcoreguidelines-slicing"Clement Courbet2016-07-221-23/+0
| | | | | | Tests fail on clang-x64-ninja-win7 due to too narrow expectation. llvm-svn: 276413
* [clang-tidy] new cppcoreguidelines-slicingClement Courbet2016-07-221-0/+23
| | | | | | | | | | | | 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
* fix missing newline in sphinx docEtienne Bergeron2016-07-131-0/+1
| | | | llvm-svn: 275254
* [clang-tidy] UnnecessaryValueParamCheck - suggest std::move() if non-const ↵Felix Berger2016-07-011-1/+23
| | | | | | | | | | | | | | | | | | | | value parameter can be moved. Summary: Make check more useful in the following two cases: The parameter is passed by non-const value, has a non-deleted move constructor and is only referenced once in the function as argument to the type's copy constructor. The parameter is passed by non-const value, has a non-deleted move assignment operator and is only referenced once in the function as argument of the the type's copy assignment operator. In this case suggest a fix to move the parameter which avoids the unnecessary copy and is closest to what the user might have intended. Reviewers: alexfh, sbenza Subscribers: cfe-commits, Prazek Differential Revision: http://reviews.llvm.org/D20277 llvm-svn: 274380
* [clang-tidy] Add modernize-use-usingKrystyna Gajczyk2016-06-252-0/+27
| | | | | | http://reviews.llvm.org/D18919 llvm-svn: 273786
* [clang-tidy] Add modernize-use-emplacePiotr Padlewski2016-06-212-0/+70
| | | | | | | | | | Summary: Add check that replaces call of push_back to emplace_back Reviewers: hokein Differential Revision: http://reviews.llvm.org/D20964 llvm-svn: 273275
* [clang-tidy] misc-move-const-arg: Detect if result of std::move() is being ↵Alexander Kornienko2016-06-161-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | passed as a const ref argument Summary: Conceptually, this is very close to the existing functionality of misc-move-const-arg, which is why I'm adding it here and not creating a new check. For example, for a type A that is both movable and copyable, this const A a1; A a2(std::move(a1)); is not only a case where a const argument is being passed to std::move(), but the result of std::move() is also being passed as a const reference (due to overload resolution). The new check typically triggers (exclusively) in cases where people think they're dealing with a movable type, but in fact the type is not movable. Reviewers: hokein, aaron.ballman, alexfh Subscribers: aaron.ballman, cfe-commits Patch by Martin Boehme! Differential Revision: http://reviews.llvm.org/D21223 llvm-svn: 272896
* [Clang-tidy] Alphabetical checks order in release notes.Eugene Zelenko2016-06-071-1/+1
| | | | | | Highlight return statement in misc-unconventional-assign-operator documentation. llvm-svn: 272042
* [Clang-tidy] Documentation style consistency.Eugene Zelenko2016-06-071-9/+10
| | | | llvm-svn: 272038
* Add the misc-misplaced-const check to clang-tidy, which diagnoses when a ↵Aaron Ballman2016-06-072-1/+22
| | | | | | const-qualifier is applied to a typedef of pointer type rather than to the pointee type. llvm-svn: 272025
* [clang-tidy] modernize-use-auto: don't remove stars by defaultAlexander Kornienko2016-06-031-2/+19
| | | | | | | | | | | | | | | Summary: By default, modernize-use-auto check will retain stars when replacing an explicit type with `auto`: `MyType *t = new MyType;` will be changed to `auto *t = new MyType;`, thus resulting in more consistency with the recommendations to use `auto *` for iterating over pointers in range-based for loops: http://llvm.org/docs/CodingStandards.html#beware-unnecessary-copies-with-auto The new `RemoveStars` option allows to revert to the old behavior: with the new option turned on the check will change `MyType *t = new MyType;` to `auto t = new MyType;`. Reviewers: aaron.ballman, sbenza Subscribers: Eugene.Zelenko, cfe-commits Differential Revision: http://reviews.llvm.org/D20917 llvm-svn: 271739
* Fix docsAlexander Kornienko2016-05-201-3/+3
| | | | llvm-svn: 270288
* [clang-tidy] Add more descriptive comments and examples in ↵Haojian Wu2016-05-201-8/+41
| | | | | | | | | | | | misc-definitions-in-headers check. Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D20463 llvm-svn: 270197
* [clang-tidy] Fix/add style guide links.Alexander Kornienko2016-05-193-1/+14
| | | | | | Thanks to Tim Halloran for the initial patch (http://reviews.llvm.org/D15089)! llvm-svn: 270033
* [clang-tidy] Fix doc titles.Alexander Kornienko2016-05-195-1/+12
| | | | llvm-svn: 270032
* [Release notes] Mention Clang-tidy modernize-avoid-bind check.Eugene Zelenko2016-05-131-2/+2
| | | | | | Fix some problems in its documentation. llvm-svn: 269517
* [clang-tidy] Adds modernize-avoid-bind checkJonathan Coe2016-05-122-0/+39
| | | | | | | | | | | | | | | Summary: This patch adds a check that replaces std::bind with a lambda. Not yet working for member functions. Reviewers: aaron.ballman, alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D16962 llvm-svn: 269341
* [clang-tidy] Improve misc-redundant-expression and decrease false-positiveEtienne Bergeron2016-05-121-0/+1
| | | | | | | | | | | | | | | | | | Summary: This patch is adding support for conditional expression and overloaded operators. To decrease false-positive, this patch is adding a list of banned macro names that has multiple variant with same integer value. Also fixed support for template instantiation and added an unittest. Reviewers: alexfh Subscribers: klimek, Sarcasm, cfe-commits Differential Revision: http://reviews.llvm.org/D19703 llvm-svn: 269275
* [Clang-tidy] modernize-use-bool-literals: documentation style.Eugene Zelenko2016-05-111-1/+1
| | | | | | Fix readability-redundant-control-flow warnings in regression test. llvm-svn: 269229
* [clang-tidy] Adds modernize-use-bool-literals check.Jakub Staron2016-05-112-0/+19
| | | | | | Review link: http://reviews.llvm.org/D18745 llvm-svn: 269171
* [clang-tidy] new google-default-arguments checkHaojian Wu2016-05-092-0/+9
| | | | | | | | | | | | | | | | Summary: To check the google style guide rule here: https://google.github.io/styleguide/cppguide.html#Default_Arguments Patch by Clement Courbet! Reviewers: hokein Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D19534 llvm-svn: 268919
* Fix docs.Alexander Kornienko2016-05-091-1/+1
| | | | llvm-svn: 268899
* [Documentation] List Clang-tidy checks alphabetically.Eugene Zelenko2016-05-051-1/+1
| | | | llvm-svn: 268659
* [clang-tidy] New: checker misc-unconventional-assign-operator replacing ↵Gabor Horvath2016-05-043-13/+14
| | | | | | | | | | | | | | 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
* [clang-tidy] Add modernize-make-shared checkPiotr Padlewski2016-05-022-0/+17
| | | | | | | | | Because modernize-make-shared do almost the same job as modernize-make-unique, I refactored common code to MakeSmartPtrCheck. http://reviews.llvm.org/D19183 llvm-svn: 268253
* Add a clang-tidy check that flags string-to-number conversion functions that ↵Aaron Ballman2016-04-292-0/+29
| | | | | | | | have insufficient error checking, suggesting a better alternative. This check corresponds to: https://www.securecoding.cert.org/confluence/display/c/ERR34-C.+Detect+errors+when+converting+a+string+to+a+number llvm-svn: 268100
* Add boost-use-to-stringPiotr Padlewski2016-04-293-1/+27
| | | | | | http://reviews.llvm.org/D18136 llvm-svn: 268079
* [clang-tidy] cppcoreguidelines-pro-type-member-init should not complain ↵Alexander Kornienko2016-04-281-4/+4
| | | | | | | | | | | | | | | | 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
* [clang-tidy] Now adding correct misc-move-const-arg documentation ;]Alexander Kornienko2016-04-261-7/+7
| | | | | | + brushed the code a bit and renamed the test file to match the check name llvm-svn: 267592
* [clang-tidy] Added misc-move-const-arg docs.Alexander Kornienko2016-04-262-1/+17
| | | | llvm-svn: 267587
* [Release notes] Mention Clang-tidy misc-fold-init-type check.Eugene Zelenko2016-04-261-4/+4
| | | | | | Highlighting consistency in Clang-tidy misc-fold-init-type check documentation. llvm-svn: 267576
* [clang-tidy] New checker for redundant expressions.Etienne Bergeron2016-04-262-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This checker finds redundant expression on both side of a binary operator. The current implementation provide a function to check whether expressions are equivalent. This implementation is able to recognize the common subset encounter in C++ program. Side-effects like "x++" are not considered to be equivalent. There are many False Positives related to macros and to floating point computations (detecting NaN). The checker is ignoring these cases. Example: ``` if( !dst || dst->depth != desired_depth || dst->nChannels != desired_num_channels || dst_size.width != src_size.width || dst_size.height != dst_size.height ) <<--- bug { ``` Reviewers: alexfh Subscribers: danielmarjamaki, fahlgren, jordan_rose, zaks.anna, Eugene.Zelenko, cfe-commits Differential Revision: http://reviews.llvm.org/D19451 llvm-svn: 267574
* A clang-tidy check for std:accumulate.Alexander Kornienko2016-04-262-0/+28
| | | | | | | | | | | | | | | | | Summary: For folds (e.g. std::accumulate), check matches between the provided init value and the range's value_type. A typical error is "std::accumulate(begin, end, 0);", where begin and end have float value_type. See the documentation for more examples. For now we check std::accumulate, std::reduce and std::inner_product. Reviewers: hokein, alexfh Subscribers: Prazek, aaron.ballman, cfe-commits, courbet Patch by Clément Courbet! Differential Revision: http://reviews.llvm.org/D18442 llvm-svn: 267542
* [Release Notes] Mention Clang-tidy misc-string-constructor and ↵Eugene Zelenko2016-04-211-1/+0
| | | | | | | | misc-suspicious-string-compare checks. Fix excessive line in misc-string-constructor documentation. llvm-svn: 267026
* [clang-tidy] New checker to detect suspicious string constructor.Etienne Bergeron2016-04-212-0/+37
| | | | | | | | | | | | | | | | | | | Summary: Checker to validate string constructor parameters. A common mistake is to swap parameter for the fill-constructor. ``` std::string str('x', 4); std::string str('4', x); ``` Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D19146 llvm-svn: 267011
* [clang-tidy] Add new checker for comparison with runtime string functions.Etienne Bergeron2016-04-212-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This checker is validating suspicious usage of string compare functions. Example: ``` if (strcmp(...)) // Implicitly compare to zero if (!strcmp(...)) // Won't warn if (strcmp(...) != 0) // Won't warn ``` This patch was checked over large amount of code. There is three checks: [*] Implicit comparator to zero (coding-style, many warnings found), [*] Suspicious implicit cast to non-integral (bugs!?, almost none found), [*] Comparison to suspicious constant (bugs!?, found two cases), Example: [[https://github.com/kylepjohnson/sigma/blob/master/sigma/native-installers/debian/dependencies/files/opt/sigma/E/HEURISTICS/che_to_precgen.c | https://github.com/kylepjohnson/sigma/blob/master/sigma/native-installers/debian/dependencies/files/opt/sigma/E/HEURISTICS/che_to_precgen.c]] ``` else if(strcmp(id, "select") == 0) { array->array[i].key1 = 25; } else if(strcmp(id, "sk") == 28) // BUG!? { array->array[i].key1 = 20; } ``` Reviewers: alexfh Subscribers: Eugene.Zelenko, cfe-commits Differential Revision: http://reviews.llvm.org/D18703 llvm-svn: 267009
* Initial version of misc-unused-using-decl check.Daniel Jasper2016-04-192-0/+15
| | | | llvm-svn: 266735
* [clang-tidy] Add new checker for suspicious sizeof expressionsEtienne Bergeron2016-04-152-0/+138
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This check is finding suspicious cases of sizeof expression. Sizeof expression is returning the size (in bytes) of a type or an expression. Programmers often abuse or misuse this expression. This checker is adding common set of patterns to detect some of these bad constructs. Some examples found by this checker: R/packages/ifultools/ifultools/src/fra_neig.c ``` /* free buffer memory */ (void) mutil_free( dist_buff, sizeof( ctr * sizeof( double ) ) ); (void) mutil_free( nidx_buff, sizeof( ctr * sizeof( sint32 ) ) ); ``` graphviz/v2_20_2/lib/common/utils.c ``` static Dtdisc_t mapDisc = { offsetof(item, p), sizeof(2 * sizeof(void *)), offsetof(item, link), (Dtmake_f) newItem, (Dtfree_f) freeItem, (Dtcompar_f) cmpItem, NIL(Dthash_f), NIL(Dtmemory_f), NIL(Dtevent_f) }; ``` mDNSResponder/mDNSShared/dnsextd.c ``` context = ( TCPContext* ) malloc( sizeof( TCPContext ) ); require_action( context, exit, err = mStatus_NoMemoryErr; LogErr( "AcceptTCPConnection", "malloc" ) ); mDNSPlatformMemZero( context, sizeof( sizeof( TCPContext ) ) ); context->d = self; ``` Reviewers: alexfh Subscribers: malcolm.parsons, Eugene.Zelenko, cfe-commits Differential Revision: http://reviews.llvm.org/D19014 llvm-svn: 266451
* [clang-tidy] Add checker for operations between integrals and pointersEtienne Bergeron2016-04-152-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This check is finding suspicious operations involving pointers and integral types; which are most likely bugs. Examples: subversion/v1_6/subversion/libsvn_subr/utf.c ``` static const char * fuzzy_escape(const char *src, apr_size_t len, apr_pool_t *pool) { [...] while (src_orig < src_end) { if (! svn_ctype_isascii(*src_orig) || src_orig == '\0') // Should be *src_orig { ``` apache2/v2_2_23/modules/metadata/mod_headers.c ``` static char *parse_format_tag(apr_pool_t *p, format_tag *tag, const char **sa) { [...] tag->arg = '\0'; // ERROR: tag->arg has type char* /* grab the argument if there is one */ if (*s == '{') { ++s; tag->arg = ap_getword(p,&s,'}'); } ``` Reviewers: alexfh Subscribers: Eugene.Zelenko, cfe-commits Differential Revision: http://reviews.llvm.org/D19118 llvm-svn: 266450
* [clang-tidy] Add check misc-multiple-statement-macroSamuel Benzaquen2016-04-142-0/+17
| | | | | | | | | | | | | | | Summary: The check detects multi-statement macros that are used in unbraced conditionals. Only the first statement will be part of the conditionals and the rest will fall outside of it and executed unconditionally. Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D18766 llvm-svn: 266369
* [clang-tidy] Fix documentation generation.Etienne Bergeron2016-04-141-0/+1
| | | | | | | | | | | | Summary: The patch is fixing the generation of clang-tidy documentation. Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D19121 llvm-svn: 266333
* Complete support for C++ Core Guidelines Type.6: Always initialize a member ↵Alexander Kornienko2016-04-131-9/+28
| | | | | | | | | | | | | | | | 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] Add a readability-deleted-default clang-tidy check.Alexander Kornienko2016-04-132-0/+22
| | | | | | | | | | | Checks if constructors and assignment operators that are marked '= default' are actually deleted by the compiler. Patch by Alex Pilkiewicz! Differential Revision: http://reviews.llvm.org/D18961 llvm-svn: 266190
* [clang-tidy] cppcoreguidelines-interfaces-global-initAlexander Kornienko2016-04-082-0/+15
| | | | | | | | | | | | | | | | 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
* [clang-tidy] add new checker for string literal with NUL character.Etienne Bergeron2016-04-072-0/+39
| | | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds the support for detecting suspicious string literals and their //incorrect// usage. The following example shows a incorrect character escaping leading to an embedded NUL character. ``` std::string str = "\0x42"; // Should be "\x42". ``` The patch also add detection of truncated literal when a literal is passed to a string constructor. Reviewers: hokein, alexfh Subscribers: LegalizeAdulthood, bcraig, Eugene.Zelenko, bkramer, cfe-commits Differential Revision: http://reviews.llvm.org/D18783 llvm-svn: 265691
* [clang-tidy] fix building clang-tidy documentation.Etienne Bergeron2016-04-062-2/+3
| | | | | | | | | | | | | | | | | | Summary: The clang-tidy documentation can't be generated because of broken links. ``` Warning, treated as error: /home/etienneb/llvm/llvm/tools/clang/tools/extra/docs/clang-tidy/checks/google-readability-function-size.rst:: WARNING: document isn't included in any toctree ``` Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D18803 llvm-svn: 265539
* [clang-tidy] Extension of checker misc-misplaced-widening-castGabor Horvath2016-04-061-4/+15
| | | | | | | | | | | | | | | | | | Summary: Existing checker misc-misplaced-widening-cast was extended: - New use cases: casted expression as lhs or rhs of a logical comparison or function argument - New types: beside int, long and long long various char types, short and int128 added - New option to check implicit casts: forgetting a cast is at least as common and as dangerous as misplacing it. This option can be disabled. This patch depends on AST Matcher patches D17986 and D18243 and also contains fix for checker misc-bool-pointer-implicit-conversion needed because of the fix in the AST Matcher patch. Reviewers: hokein, alexfh Subscribers: o.gyorgy, xazax.hun, cfe-commits Differential Revision: http://reviews.llvm.org/D17987 llvm-svn: 265532
OpenPOWER on IntegriCloud