| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
| |
This reverts commit r276640. Breaks multiple buildbots.
llvm-svn: 276651
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
Second try for r276408
llvm-svn: 276415
|
|
|
|
|
|
| |
Tests fail on clang-x64-ninja-win7 due to too narrow expectation.
llvm-svn: 276413
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
llvm-svn: 275254
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
http://reviews.llvm.org/D18919
llvm-svn: 273786
|
|
|
|
|
|
|
|
|
|
| |
Summary: Add check that replaces call of push_back to emplace_back
Reviewers: hokein
Differential Revision: http://reviews.llvm.org/D20964
llvm-svn: 273275
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
Highlight return statement in misc-unconventional-assign-operator documentation.
llvm-svn: 272042
|
|
|
|
| |
llvm-svn: 272038
|
|
|
|
|
|
| |
const-qualifier is applied to a typedef of pointer type rather than to the pointee type.
llvm-svn: 272025
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
llvm-svn: 270288
|
|
|
|
|
|
|
|
|
|
|
|
| |
misc-definitions-in-headers check.
Reviewers: alexfh
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D20463
llvm-svn: 270197
|
|
|
|
|
|
| |
Thanks to Tim Halloran for the initial patch (http://reviews.llvm.org/D15089)!
llvm-svn: 270033
|
|
|
|
| |
llvm-svn: 270032
|
|
|
|
|
|
| |
Fix some problems in its documentation.
llvm-svn: 269517
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
Fix readability-redundant-control-flow warnings in regression test.
llvm-svn: 269229
|
|
|
|
|
|
| |
Review link: http://reviews.llvm.org/D18745
llvm-svn: 269171
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
llvm-svn: 268899
|
|
|
|
| |
llvm-svn: 268659
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
http://reviews.llvm.org/D18136
llvm-svn: 268079
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
+ brushed the code a bit and renamed the test file to match the check name
llvm-svn: 267592
|
|
|
|
| |
llvm-svn: 267587
|
|
|
|
|
|
| |
Highlighting consistency in Clang-tidy misc-fold-init-type check documentation.
llvm-svn: 267576
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
misc-suspicious-string-compare checks.
Fix excessive line in misc-string-constructor documentation.
llvm-svn: 267026
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
llvm-svn: 266735
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|