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

Conrad Poelman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 28 22:27:13 PDT 2019


poelmanc created this revision.
poelmanc added a reviewer: MyDeveloperDay.
poelmanc added a project: clang-tools-extra.
Herald added subscribers: cfe-commits, mgehre.
Herald added a project: clang.

This patch adds a feature requested by @MyDeveloperDay at https://reviews.llvm.org/D69238, @MyDeveloperDay to enable `readability-redundant-string-init` to take a list of strings to apply the fix to rather than hard-coding `basic_string`. It adds a `StringNames` option of semicolon-delimited names of string classes to which to apply this fix. Tests ensure this works with test class OurTestString as well as std::string and std::wstring as before. It should be applicable to llvm::StringRef, QString, etc.

This diff is currently based on https://reviews.llvm.org/D69238. Both make changes to the top of readability-redundant-string-init.cpp. I'm happy to rebase it on any version desired.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D69548

Files:
  clang-tools-extra/clang-tidy/readability/RedundantStringInitCheck.cpp
  clang-tools-extra/clang-tidy/readability/RedundantStringInitCheck.h
  clang-tools-extra/docs/clang-tidy/checks/readability-redundant-string-init.rst
  clang-tools-extra/test/clang-tidy/checkers/readability-redundant-string-init.cpp
  clang/include/clang/ASTMatchers/ASTMatchers.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69548.226836.patch
Type: text/x-patch
Size: 7426 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191029/c5dd3c4d/attachment-0001.bin>


More information about the cfe-commits mailing list