[PATCH] D145724: [clang-tidy] Provide default template arguments in <string>

Piotr Zegar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 12 06:35:18 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rGc4918cbf3ba3: [clang-tidy] Provide default template arguments in <string> (authored by mikecrowe, committed by PiotrZSL).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145724

Files:
  clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/string


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
@@ -12,7 +12,7 @@
 class allocator {};
 template <typename T>
 class char_traits {};
-template <typename C, typename T, typename A>
+template <typename C, typename T = char_traits<C>, typename A = allocator<C>>
 struct basic_string {
   typedef size_t size_type;
   typedef basic_string<C, T, A> _Type;
@@ -55,19 +55,19 @@
   _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;
+typedef basic_string<char> string;
+typedef basic_string<wchar_t> wstring;
+typedef basic_string<char16> u16string;
+typedef basic_string<char32> u32string;
 
-template <typename C, typename T>
+template <typename C, typename T = char_traits<C>>
 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;
+typedef basic_string_view<char> string_view;
+typedef basic_string_view<wchar_t> wstring_view;
+typedef basic_string_view<char16> u16string_view;
+typedef basic_string_view<char32> u32string_view;
 
 std::string operator+(const std::string&, const std::string&);
 std::string operator+(const std::string&, const char*);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145724.504429.patch
Type: text/x-patch
Size: 1931 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230312/ac1d984e/attachment.bin>


More information about the cfe-commits mailing list