Revision tags: llvmorg-18.1.8 |
|
#
415a82c6 |
| 10-Jun-2024 |
Clement Courbet <courbet@google.com> |
[clang-tidy] `doesNotMutateObject`: Handle calls to member functions … (#94362)
…and operators that have non-const overloads.
This allows `unnecessary-copy-initialization` to warn on more cases.
[clang-tidy] `doesNotMutateObject`: Handle calls to member functions … (#94362)
…and operators that have non-const overloads.
This allows `unnecessary-copy-initialization` to warn on more cases.
The common case is a class with a a set of const/non-sconst overloads
(e.g. std::vector::operator[]).
```
void F() {
std::vector<Expensive> v;
// ...
const Expensive e = v[i];
}
```
show more ...
|
Revision tags: llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1 |
|
#
308a2360 |
| 07-Mar-2024 |
Clement Courbet <courbet@google.com> |
[clang-tidy] `isOnlyUsedAsConst`: Handle static method calls. (#84005)
... using method syntax:
```
struct S {
static void f()
};
void DoIt(S& s) {
s.f(); // Does not mutate `s` throu
[clang-tidy] `isOnlyUsedAsConst`: Handle static method calls. (#84005)
... using method syntax:
```
struct S {
static void f()
};
void DoIt(S& s) {
s.f(); // Does not mutate `s` through the `this` parameter.
}
```
show more ...
|
Revision tags: llvmorg-18.1.0, llvmorg-18.1.0-rc4 |
|
#
94ca854d |
| 26-Feb-2024 |
Clement Courbet <courbet@google.com> |
[clang-tidy] Add support for determining constness of more expressions. (#82617)
This uses a more systematic approach for determining whcich
`DeclRefExpr`s mutate the underlying object: Instead of
[clang-tidy] Add support for determining constness of more expressions. (#82617)
This uses a more systematic approach for determining whcich
`DeclRefExpr`s mutate the underlying object: Instead of using a few
matchers, we walk up the AST until we find a parent that we can prove
cannot change the underlying object.
This allows us to handle most address taking and dereference, bindings
to value and const& variables, and track constness of pointee (see
changes in DeclRefExprUtilsTest.cpp).
This allows supporting more patterns in
`performance-unnecessary-copy-initialization`.
Those two patterns are relatively common:
```
const auto e = (*vector_ptr)[i]
```
and
```
const auto e = vector_ptr->at(i);
```
In our codebase, we have around 25% additional findings from
`performance-unnecessary-copy-initialization` with this change. I did
not see any additional false positives.
show more ...
|
Revision tags: llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init, llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init |
|
#
1e512688 |
| 23-Jul-2023 |
Shivam Gupta <Shivam.Gupta2@amd.com> |
[clang-tidy] performance-* checks: Also allow allow member expressions to be used in a const manner.
Until now when determining all the const uses of a VarDecl we only considered how the variable it
[clang-tidy] performance-* checks: Also allow allow member expressions to be used in a const manner.
Until now when determining all the const uses of a VarDecl we only considered how the variable itself was used. This change extends checking for const usages of the type's members as well.
This increases the number of true positives for various performance checks that share the same const usage analysis.
Path by Felix Berger
Reviewed By: njames93, PiotrZSL
Differential Revision: https://reviews.llvm.org/D97567
show more ...
|
Revision tags: llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3, llvmorg-16.0.0-rc2, llvmorg-16.0.0-rc1, llvmorg-17-init, llvmorg-15.0.7, llvmorg-15.0.6, llvmorg-15.0.5, llvmorg-15.0.4, llvmorg-15.0.3, working, llvmorg-15.0.2, llvmorg-15.0.1, llvmorg-15.0.0, llvmorg-15.0.0-rc3, llvmorg-15.0.0-rc2, llvmorg-15.0.0-rc1, llvmorg-16-init, llvmorg-14.0.6, llvmorg-14.0.5, llvmorg-14.0.4, llvmorg-14.0.3, llvmorg-14.0.2, llvmorg-14.0.1, llvmorg-14.0.0, llvmorg-14.0.0-rc4, llvmorg-14.0.0-rc3, llvmorg-14.0.0-rc2, llvmorg-14.0.0-rc1, llvmorg-15-init, llvmorg-13.0.1, llvmorg-13.0.1-rc3, llvmorg-13.0.1-rc2 |
|
#
3b724480 |
| 24-Nov-2021 |
Clement Courbet <courbet@google.com> |
[clang-tidy] Add unit tests for `DeclRefExprUtils`.
In preparation for D114539.
|