Summary:
This checks for calls to double-precision math.h with single-precision
arguments. For example, it suggests replacing ::sin(0.f) with
::sinf(0.f).
Subscribers: mgorny, cfe-commits
Differential Revision: https://reviews.llvm.org/D27284
llvm-svn: 289627
Summary: Virtual method overrides of dependent types cannot be recognized unless
they are marked as override or final.
Exclude methods marked as final from check and add test.
Reviewers: sbenza, hokein, alexfh
Subscribers: malcolm.parsons, JDevlieghere, cfe-commits
Differential Revision: https://reviews.llvm.org/D27248
llvm-svn: 288502
Summary: Suppress fixes for functions that are referenced within the
compilation unit outside of a call expression as the signature change
could break the code referencing the function.
We still issue a warning in this case so that users can decide to
manually change the function signature.
Reviewers: alexfh, sbenza, aaron.ballman
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D26203
llvm-svn: 286424
Summary:
This will prevent the check warning the variables which have been
implicitly added by compiler, like the following case (in for-range loop):
the variable '__end' is copy-constructed from a const reference...
Reviewers: alexfh
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D25911
llvm-svn: 286186
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
Summary:
Also trigger the check in the following case:
void foo() {
ExpensiveToCopy Obj;
const auto UnnecessaryCopy = Obj.constReference();
Obj.onlyUsedAsConst();
}
i.e. when the object the method is called on is not const but is never
modified.
Reviewers: alexfh, fowles
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D20010
llvm-svn: 271239
Summary:
This patch is lifting matchers used by more than one checkers
to the common namespace.
Reviewers: aaron.ballman, alexfh
Subscribers: aaron.ballman, cfe-commits
Differential Revision: http://reviews.llvm.org/D19841
llvm-svn: 269804
Summary:
Lift some common code used by multiple checkers.
This function is also used by checkers that are coming.
It is quite common for a checker to parse a list of names.
Reviewers: alexfh
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D19846
llvm-svn: 269065
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
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
Summary:
This is the same kind of bug than [[ http://reviews.llvm.org/D18238 | D18238 ]].
Fix crashes caused by deferencing null pointer when declarations parsing may be delayed.
The body of the declarations may be null.
The crashes were observed with a Windows build of clang-tidy and the following command-line.
```
command-line switches: -fms-compatibility-version=19 -fms-compatibility
```
Reviewers: alexfh
Subscribers: kimgr, LegalizeAdulthood, cfe-commits
Differential Revision: http://reviews.llvm.org/D18852
llvm-svn: 265681
Going through a string removes some of the smarts of the diagnosic printer
and makes the code more complicated. This change has some cosmetic impact
on the output but that's mostly minor.
llvm-svn: 265680
Summary: Extends the UnnecessaryCopyInitialization to detect copies of local variables and parameters that are unneeded.
Patch by Matt Kulukundis!
Reviewers: alexfh, hokein
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D18149
llvm-svn: 264146
Summary:
Move code shared between UnnecessaryCopyInitialization and ForRangeCopyCheck into utilities files.
Add more test cases for UnnecessaryCopyInitialization and disable fixes inside of macros.
Reviewers: alexfh
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D17488
llvm-svn: 262781
Summary:
Fix oversight not checking the value of the Optional<bool> returned by
isExpensiveToCopy().
Reviewers: alexfh
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D17064
llvm-svn: 260870
Summary:
Add check performance-faster-string-find.
It replaces single character string literals to character literals in calls to string::find and friends.
Reviewers: alexfh
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D16152
llvm-svn: 260712
Summary: This is implemented originally by Alex Pilkiewicz (pilki@google.com).
Reviewers: alexfh
Subscribers: cfe-commits
Patch by Haojian Wu!
Differential Revision: http://reviews.llvm.org/D16721
llvm-svn: 259195
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
Summary: Since local static variables can outlive other local variables exclude them from the unnecessary copy initialization check.
Reviewers: alexfh
Patch by Felix Berger!
Differential Revision: http://reviews.llvm.org/D15822
llvm-svn: 256636
Summary:
The patch adds a new ClangTidy check that detects when expensive-to-copy types are unnecessarily copy initialized from a const reference that has the same or are larger scope than the copy.
It currently only detects this when the copied variable is const qualified. But this will be extended to non const variables if they are only used in a const fashion.
Reviewers: alexfh
Subscribers: cfe-commits
Patch by Felix Berger!
Differential Revision: http://reviews.llvm.org/D15623
llvm-svn: 256632