[PATCH] D91009: [clang-tidy] Include std::basic_string_view in readability-redundant-string-init.

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 19 06:35:34 PST 2020


aaron.ballman added inline comments.


================
Comment at: clang-tools-extra/test/clang-tidy/checkers/readability-redundant-string-init.cpp:25
+struct basic_string_view {
+  using size_type = unsigned;
+
----------------
nit: `using size_type = decltype(sizeof(0));`


================
Comment at: clang-tools-extra/test/clang-tidy/checkers/readability-redundant-string-init.cpp:30
+  basic_string_view(const C *, size_type);
+  basic_string_view(const C *, const A &a = A());
+  template <class It, class End>
----------------
This constructor doesn't exist according to the standard: http://eel.is/c++draft/string.view.template.general


================
Comment at: clang-tools-extra/test/clang-tidy/checkers/readability-redundant-string-init.cpp:65
 
+void fview() {
+  std::string_view a = "";
----------------
Can you also add tests for `wstring_view`?

Also, perhaps one for `std::string_view foo{};` (to remove the spurious `{}`)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D91009



More information about the cfe-commits mailing list