summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/docs/clang-tidy/checks/readability-redundant-string-init.rst
blob: c4556887f89aeda2f04bfa0501cc093acd5a8081 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
.. title:: clang-tidy - readability-redundant-string-init

readability-redundant-string-init
=================================

Finds unnecessary string initializations.

Examples
--------

.. code-block:: c++

  // Initializing string with empty string literal is unnecessary.
  std::string a = "";
  std::string b("");

  // becomes

  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.
OpenPOWER on IntegriCloud