diff options
| author | Mitchell Balan <mitchell@stellarscience.com> | 2019-11-15 16:42:43 -0500 |
|---|---|---|
| committer | Mitchell Balan <mitchell@stellarscience.com> | 2019-11-15 16:42:54 -0500 |
| commit | 96fbc32cb9ea23b1e7e3ff6906ec3ccda9500982 (patch) | |
| tree | 3c4d3be51ca45338ac36ecca6c331a976de70965 /clang-tools-extra/docs/clang-tidy | |
| parent | 51a0a4e355d4fc18b1b00149ea08786de52ccbe9 (diff) | |
| download | bcm5719-llvm-96fbc32cb9ea23b1e7e3ff6906ec3ccda9500982.tar.gz bcm5719-llvm-96fbc32cb9ea23b1e7e3ff6906ec3ccda9500982.zip | |
[clang-tidy] Give readability-redundant-string-init a customizable list of string types to fix
Summary:
This patch adds a feature requested in https://reviews.llvm.org/D69238 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 out::TestString as well as std::string and std::wstring as before. It should be applicable to llvm::StringRef, QString, etc.
Reviewers: MyDeveloperDay, aaron.ballman, hokein, alexfh, JonasToth, gribozavr2
Patch by: poelmanc
Subscribers: gribozavr2, xazax.hun, Eugene.Zelenko, cfe-commits
Tags: #clang-tools-extra, #clang
Differential Revision: https://reviews.llvm.org/D69548
Diffstat (limited to 'clang-tools-extra/docs/clang-tidy')
| -rw-r--r-- | clang-tools-extra/docs/clang-tidy/checks/readability-redundant-string-init.rst | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/clang-tools-extra/docs/clang-tidy/checks/readability-redundant-string-init.rst b/clang-tools-extra/docs/clang-tidy/checks/readability-redundant-string-init.rst index e4136ea4234..c4556887f89 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/readability-redundant-string-init.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/readability-redundant-string-init.rst @@ -5,7 +5,8 @@ readability-redundant-string-init Finds unnecessary string initializations. -Examples: +Examples +-------- .. code-block:: c++ @@ -17,3 +18,15 @@ Examples: std::string a; std::string b; + +Options +------- + +.. option:: StringNames + + Default is `::std::basic_string`. + + Semicolon-delimited list of class names to apply this check to. + By default `::std::basic_string` applies to ``std::string`` and + ``std::wstring``. Set to e.g. `::std::basic_string;llvm::StringRef;QString` + to perform this check on custom classes. |

