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 VALUE (1)
bool f(std::set<int> s) {
return std::find(s.begin(), s.end(), VALUE) != s.end();
}
Suggestion currently is:
<source>:7:10: warning: this STL algorithm call should be replaced with a container method [performance-inefficient-algorithm]
7 | return std::find(s.begin(), s.end(), VALUE) != s.end();
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| s.find()
It should be s.find(VALUE).
Godbolt: https://godbolt.org/z/55v5PcMKE
@llvm/issue-subscribers-clang-tidy
Author: David Meng (davidmenggx)
The suggestion generated does not compile:
#include <set>
#include <algorithm>
#define VALUE (1)
bool f(std::set<int> s) {
return std::find(s.begin(), s.end(), VALUE) != s.end();
}
Suggestion currently is:
<source>:7:10: warning: this STL algorithm call should be replaced with a container method [performance-inefficient-algorithm]
7 | return std::find(s.begin(), s.end(), VALUE) != s.end();
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| s.find()
It should be s.find(VALUE).
Godbolt: https://godbolt.org/z/55v5PcMKE