[PATCH] D69548: Give clang-tidy readability-redundant-string-init a customizable list of string types to fix

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 29 13:45:03 PDT 2019


aaron.ballman added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/readability/RedundantStringInitCheck.cpp:21
 
+const char DefaultStringNames[] = "basic_string";
+
----------------
I think the default should probably be `::std::basic_string` to avoid getting other things named `basic_string`?


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/readability-redundant-string-init.rst:27
+
+    Default is ``basic_string``.
+
----------------
Eugene.Zelenko wrote:
> Please use single back-ticks for options. Same below.
Should update this as well if you go with the suggest change to `::std::basic_string`.


================
Comment at: clang/include/clang/ASTMatchers/ASTMatchers.h:2563-2565
+inline internal::Matcher<NamedDecl> hasListedName(const std::vector<std::string> &Names) {
+  return internal::Matcher<NamedDecl>(new internal::HasNameMatcher(Names));
+}
----------------
I think we should try to get the existing `hasAnyName()` matcher to work with a vector of strings instead of adding a new matcher to do the same thing.


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D69548





More information about the cfe-commits mailing list