[clang-tools-extra] [clang-tidy] Add readability-string-view-substr check (PR #120055)
Denis Mikhailov via cfe-commits
cfe-commits at lists.llvm.org
Sat Dec 21 12:15:07 PST 2024
================
@@ -0,0 +1,108 @@
+// RUN: %check_clang_tidy %s readability-stringview-substr %t
+
+namespace std {
+template <typename T>
+class basic_string_view {
+public:
+ using size_type = unsigned long;
+ static constexpr size_type npos = -1;
+
+ basic_string_view(const char*) {}
+ basic_string_view substr(size_type pos, size_type count = npos) const { return *this; }
+ void remove_prefix(size_type n) {}
+ void remove_suffix(size_type n) {}
+ size_type length() const { return 0; }
----------------
denzor200 wrote:
Please add `size_type size() const { return 0; }` and unit-tests for it
https://github.com/llvm/llvm-project/pull/120055
More information about the cfe-commits
mailing list