diff options
| author | FabianWolff <16052130+FabianWolff@users.noreply.github.com> | 2025-05-27 12:06:08 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-27 12:06:08 +0200 |
| commit | 47d5e94acb92ce4ec5040e95e167ba471d080244 (patch) | |
| tree | adf32fce5c38981929d399f4603b119f0c11de1b /llvm/lib/Bitcode/Reader/BitcodeReader.cpp | |
| parent | 94929b725f415a8ab8de35194f3c2eec5192990f (diff) | |
[clang-tidy] readability-redundant-smartptr-get: disable for smart pointers to arrays (#141092)
Currently we generate an incorrect suggestion for shared/unique pointers
to arrays; for instance ([Godbolt](https://godbolt.org/z/Tens1reGP)):
```c++
#include <memory>
void test_shared_ptr_to_array() {
std::shared_ptr<int[]> i;
auto s = sizeof(*i.get());
}
```
```
<source>:5:20: warning: redundant get() call on smart pointer [readability-redundant-smartptr-get]
5 | auto s = sizeof(*i.get());
| ^~~~~~~
| i
1 warning generated.
```
`sizeof(*i)` is incorrect, though, because the array specialization of
`std::shared/unique_ptr` does not have an `operator*()`. Therefore I
have disabled this check for smart pointers to arrays for now; future
work could, of course, improve on this by suggesting, say,
`sizeof(i[0])` in the above example.
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
0 files changed, 0 insertions, 0 deletions
