mikecrowe added a comment.

In D144216#4133671 <https://reviews.llvm.org/D144216#4133671>, @Eugene.Zelenko 
wrote:

> May be you could use heard in other test in same patch?

I'm not quite sure what you mean by "heard". Searching for "heard" in the LLVM 
code and Googling "llvm heard" reveal nothing useful. Please can you explain 
what you mean?

If you're suggesting that I could use the new `<string>` header to replace 
declarations of `basic_string` etc. in other tests then I think that would be 
possible with some careful checking to make sure it include the necessary 
functionality. I think that would easier to review separately rather than in a 
single patch though.



================
Comment at: 
clang-tools-extra/test/clang-tidy/checkers/readability/redundant-string-cstr.cpp:1
-// RUN: %check_clang_tidy %s readability-redundant-string-cstr %t
-
-typedef unsigned __INT16_TYPE__ char16;
-typedef unsigned __INT32_TYPE__ char32;
-typedef __SIZE_TYPE__ size;
-
-namespace std {
-template <typename T>
-class allocator {};
-template <typename T>
-class char_traits {};
-template <typename C, typename T, typename A>
-struct basic_string {
-  typedef basic_string<C, T, A> _Type;
-  basic_string();
-  basic_string(const C *p, const A &a = A());
-
-  ~basic_string();
-
-  const C *c_str() const;
-  const C *data() const;
-
-  _Type& append(const C *s);
-  _Type& append(const C *s, size n);
-  _Type& assign(const C *s);
-  _Type& assign(const C *s, size n);
-
-  int compare(const _Type&) const;
-  int compare(const C* s) const;
-  int compare(size pos, size len, const _Type&) const;
-  int compare(size pos, size len, const C* s) const;
-
-  size find(const _Type& str, size pos = 0) const;
-  size find(const C* s, size pos = 0) const;
-  size find(const C* s, size pos, size n) const;
-
-  _Type& insert(size pos, const _Type& str);
-  _Type& insert(size pos, const C* s);
-  _Type& insert(size pos, const C* s, size n);
-
-  _Type& operator+=(const _Type& str);
-  _Type& operator+=(const C* s);
-  _Type& operator=(const _Type& str);
-  _Type& operator=(const C* s);
-};
-
-typedef basic_string<char, std::char_traits<char>, std::allocator<char>> 
string;
-typedef basic_string<wchar_t, std::char_traits<wchar_t>, 
std::allocator<wchar_t>> wstring;
-typedef basic_string<char16, std::char_traits<char16>, std::allocator<char16>> 
u16string;
-typedef basic_string<char32, std::char_traits<char32>, std::allocator<char32>> 
u32string;
-
-template <typename C, typename T>
-struct basic_string_view {
-  basic_string_view(const C* s);
-};
-typedef basic_string_view<char, std::char_traits<char>> string_view;
-typedef basic_string_view<wchar_t, std::char_traits<wchar_t>> wstring_view;
-typedef basic_string_view<char16, std::char_traits<char16>> u16string_view;
-typedef basic_string_view<char32, std::char_traits<char32>> u32string_view;
-}
-
-std::string operator+(const std::string&, const std::string&);
-std::string operator+(const std::string&, const char*);
-std::string operator+(const char*, const std::string&);
-
-bool operator==(const std::string&, const std::string&);
-bool operator==(const std::string&, const char*);
-bool operator==(const char*, const std::string&);
+// RUN: %check_clang_tidy %s readability-redundant-string-cstr %t -- -- 
-isystem %clang_tidy_headers
+#include <string>
----------------
carlosgalvezp wrote:
> Where does this come from? Other tests use the actual path to the folder.
I copied it from other checks:
```
clang-tools-extra/test/clang-tidy/checkers/bugprone/signal-handler-minimal.c:// 
RUN: -- -isystem %clang_tidy_headers
clang-tools-extra/test/clang-tidy/checkers/bugprone/signal-handler-posix.c:// 
RUN: -- -isystem %clang_tidy_headers
clang-tools-extra/test/clang-tidy/checkers/bugprone/signal-handler.c:// RUN: 
%check_clang_tidy %s bugprone-signal-handler %t -- -- -isystem 
%clang_tidy_headers
clang-tools-extra/test/clang-tidy/checkers/bugprone/signal-handler.cpp:// RUN: 
%check_clang_tidy -std=c++14 %s bugprone-signal-handler %t -- -- -isystem 
%clang_tidy_headers -isystem %S/Inputs/signal-handler -target 
x86_64-unknown-unknown
clang-tools-extra/test/clang-tidy/checkers/bugprone/suspicious-include.cpp:// 
RUN: %check_clang_tidy %s bugprone-suspicious-include %t -- -- -isystem 
%clang_tidy_headers -fmodules
clang-tools-extra/test/clang-tidy/checkers/google/objc-function-naming.m:// 
RUN: %check_clang_tidy %s google-objc-function-naming %t -- -- -isystem 
%clang_tidy_headers
clang-tools-extra/test/clang-tidy/checkers/llvm/include-order.cpp:// RUN: 
%check_clang_tidy %s llvm-include-order %t -- -- -isystem %clang_tidy_headers
clang-tools-extra/test/clang-tidy/checkers/modernize/pass-by-value-macro-header.cpp://
 RUN: %check_clang_tidy %s modernize-pass-by-value %t -- -- -isystem 
%clang_tidy_headers
clang-tools-extra/test/clang-tidy/checkers/performance/move-constructor-init.cpp://
 RUN: -- -isystem %clang_tidy_headers
clang-tools-extra/test/clang-tidy/checkers/readability/redundant-string-cstr-format.cpp://
 RUN: %check_clang_tidy -check-suffix=STDFORMAT -std=c++20 %s 
readability-redundant-string-cstr %t -- --  -isystem %clang_tidy_headers 
-DTEST_STDFORMAT
clang-tools-extra/test/clang-tidy/checkers/readability/redundant-string-cstr-format.cpp://
 RUN: %check_clang_tidy -check-suffixes=STDFORMAT,STDPRINT -std=c++2b %s 
readability-redundant-string-cstr %t -- --  -isystem %clang_tidy_headers 
-DTEST_STDFORMAT -DTEST_STDPRINT
clang-tools-extra/test/clang-tidy/checkers/readability/redundant-string-cstr.cpp://
 RUN: %check_clang_tidy %s readability-redundant-string-cstr %t -- -- -isystem 
%clang_tidy_headers
```
It seems to work!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D144216

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to