llvm-project
llvm-project copied to clipboard
[clang-tidy] `performance-inefficient-algorithm` suggestion does not compile
The suggestion generated does not compile:
#include <set>
#include <algorithm>
#define SET_RANGE s.begin(), s.end()
bool f(std::set<int> s) {
return std::find(SET_RANGE, 46) != s.end();
}
Suggestion currently is:
<source>:7:12: warning: this STL algorithm call should be replaced with a container method [performance-inefficient-algorithm]
7 | return std::find(SET_RANGE, 46) != s.end();
| ^~~~~~~~~~~~~~~~~~~~~~~~
| .find(46)
Godbolt: https://godbolt.org/z/E8eovTYEe
Related: https://github.com/llvm/llvm-project/issues/217457
@llvm/issue-subscribers-clang-tidy
Author: David Meng (davidmenggx)
The suggestion generated does not compile:
```cpp
#include <set>
#include <algorithm>
#define SET_RANGE s.begin(), s.end()
bool f(std::set<int> s) { return std::find(SET_RANGE, 46) != s.end(); }
Suggestion currently is:
<source>:7:12: warning: this STL algorithm call should be replaced with a container method [performance-inefficient-algorithm] 7 | return std::find(SET_RANGE, 46) != s.end(); | ^~~~~~~~~~~~~~~~~~~~~~~~ | .find(46)
Godbolt: https://godbolt.org/z/E8eovTYEe
Related: https://github.com/llvm/llvm-project/issues/217457
</details>