[PATCH] D145310: [clang-tidy] Make readability-container-data-pointer use <string> header

Mike Crowe via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 9 12:40:08 PST 2023


mikecrowe updated this revision to Diff 503882.
mikecrowe added a comment.
Herald added a subscriber: PiotrZSL.

Rebase on top of fb7ef637a84652dbd3d973a1ba7db9470181b5aa <https://reviews.llvm.org/rGfb7ef637a84652dbd3d973a1ba7db9470181b5aa> (which is a
descendent of ae25e2f19decb94198301f0726ee613f945cc405 <https://reviews.llvm.org/rGae25e2f19decb94198301f0726ee613f945cc405> aka D144216 <https://reviews.llvm.org/D144216>, on
which this change relies.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145310/new/

https://reviews.llvm.org/D145310

Files:
  clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/string
  clang-tools-extra/test/clang-tidy/checkers/readability/container-data-pointer.cpp


Index: clang-tools-extra/test/clang-tidy/checkers/readability/container-data-pointer.cpp
===================================================================
--- clang-tools-extra/test/clang-tidy/checkers/readability/container-data-pointer.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/readability/container-data-pointer.cpp
@@ -1,4 +1,5 @@
-// RUN: %check_clang_tidy %s readability-container-data-pointer %t -- -- -fno-delayed-template-parsing
+// RUN: %check_clang_tidy %s readability-container-data-pointer %t -- -- -isystem %clang_tidy_headers -fno-delayed-template-parsing
+#include <string>
 
 typedef __SIZE_TYPE__ size_t;
 
@@ -17,22 +18,6 @@
   const T &operator[](size_type) const;
 };
 
-template <typename T>
-struct basic_string {
-  using size_type = size_t;
-
-  basic_string();
-
-  T *data();
-  const T *data() const;
-
-  T &operator[](size_t);
-  const T &operator[](size_type) const;
-};
-
-typedef basic_string<char> string;
-typedef basic_string<wchar_t> wstring;
-
 template <typename T>
 struct is_integral;
 
Index: clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/string
===================================================================
--- clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/string
+++ clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/string
@@ -42,6 +42,9 @@
   _Type& insert(size_type pos, const C* s);
   _Type& insert(size_type pos, const C* s, size_type n);
 
+  _Type& operator[](size_type);
+  const _Type& operator[](size_type) const;
+
   _Type& operator+=(const _Type& str);
   _Type& operator+=(const C* s);
   _Type& operator=(const _Type& str);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145310.503882.patch
Type: text/x-patch
Size: 1633 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230309/ef252455/attachment.bin>


More information about the cfe-commits mailing list