================
@@ -29,6 +29,43 @@ struct multimap {
   bool contains(const Key &K) const;
 };
 
+using size_t = decltype(sizeof(int));
+
+// Lightweight standin for std::string_view.
+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;
+
+// Lightweight standin for std::string.
+template <typename C>
+class basic_string {
+public:
+  basic_string();
+  basic_string(const basic_string &);
+  basic_string(const C *);
+  ~basic_string();
+  int find(basic_string 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);
+  bool contains(const C *s) const;
+  bool contains(C s) const;
+  bool contains(basic_string_view<C> s) const;
+  static constexpr size_t npos = -1;
+};
+typedef basic_string<char> string;
+
----------------
nicovank wrote:

There's [already a string mock you can 
import](https://github.com/llvm/llvm-project/blob/6022a3a05f951632022c84416209fe6d70d9105c/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/string),
 you need to edit the `RUN` command at the top of this file to have it in the 
search path.

Check [here for an 
example](https://github.com/llvm/llvm-project/blob/6022a3a05f951632022c84416209fe6d70d9105c/clang-tools-extra/test/clang-tidy/checkers/modernize/use-starts-ends-with.cpp).

https://github.com/llvm/llvm-project/pull/110351
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to