[clang-tools-extra] [clang-tidy][abseil-string-find-startswith] Add string_view to default string-like classes (PR #72283)
Nicolas van Kempen via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 14 08:50:44 PST 2023
================
@@ -22,6 +22,21 @@ struct basic_string {
typedef basic_string<char> string;
typedef basic_string<wchar_t> wstring;
+template <typename C>
+class basic_string_view {
+public:
+ basic_string_view();
+ basic_string_view(const basic_string_view &);
+ basic_string_view(const C *);
+ ~basic_string_view();
+ int find(basic_string_view s, int pos = 0);
+ int find(const C *s, int pos = 0);
+ int find(const C *s, int pos, int n);
+ int find(char c, int pos = 0);
+ static constexpr size_t npos = -1;
+};
+typedef basic_string_view<char> string_view;
----------------
nicovank wrote:
https://github.com/llvm/llvm-project/blob/57dd23bc0a2f7b4f7b68162923b3267c1f303de9/clang-tools-extra/test/clang-tidy/checkers/abseil/string-find-str-contains.cpp#L24-L37
https://github.com/llvm/llvm-project/pull/72283
More information about the cfe-commits
mailing list