-
Notifications
You must be signed in to change notification settings - Fork 13.5k
performance-unnecessary-value-param
not detected for STL container when accessed via index operator
#69577
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@llvm/issue-subscribers-clang-tidy Author: Oliver Stöneberg (firewave)
```cpp
#include <string>
void f(std::string type)
|
Also not detected with other STL containers: #include <vector>
void cb(const int *);
void f(std::vector<const int*> v)
{
if (v.size() != 2)
return;
cb(v[0]);
} |
performance-unnecessary-value-param
not detected for std::string
when accessed via index operatorperformance-unnecessary-value-param
not detected for STL container when accessed via index operator
I did some digging into this :) The code results in this AST:
The There are two different methods in std::basic_string<CharT,Traits,Allocator>::operator[], one
For some reason, it looks like |
Related/duplicate: #59750. |
https://godbolt.org/z/ae3efnTvs
The text was updated successfully, but these errors were encountered: