Issue 182012
Summary [clang-tidy] `performance-faster-string-find` not reported with libstdc++
Labels clang-tidy, libstdc++, false-negative
Assignees
Reporter firewave
    ```cpp
#include <set>
#include <string>

void f()
{
    std::set<std::string> s;
 for (const auto &str : s) {

        const std::string::size_type p = str.find("(");
    }
}
```

The following is only reported when using libc++:
```
<source>:9:51: warning: 'find' called with a string literal consisting of a single character; consider using the more effective overload accepting a character [performance-faster-string-find]
    9 |         const std::string::size_type p = str.find("(");
      | ^~~
      | '('
```

libstdc++: https://godbolt.org/z/anPhvr36f
libc++: https://godbolt.org/z/Y1ohn89rh
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to