diff options
Diffstat (limited to 'clang-tools-extra/docs')
-rw-r--r-- | clang-tools-extra/docs/ReleaseNotes.rst | 6 | ||||
-rw-r--r-- | clang-tools-extra/docs/clang-tidy/checks/abseil-redundant-strcat-calls.rst | 26 | ||||
-rw-r--r-- | clang-tools-extra/docs/clang-tidy/checks/list.rst | 1 |
3 files changed, 33 insertions, 0 deletions
diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst index d1d7f4a1f62..1e3a74abedc 100644 --- a/clang-tools-extra/docs/ReleaseNotes.rst +++ b/clang-tools-extra/docs/ReleaseNotes.rst @@ -76,6 +76,12 @@ Improvements to clang-tidy Ensures code does not open ``namespace absl`` as that violates Abseil's compatibility guidelines. +- New :doc:`abseil-redundant-strcat-calls + <clang-tidy/checks/abseil-redundant-strcat-calls>` check. + + Suggests removal of unnecessary calls to ``absl::StrCat`` when the result is + being passed to another ``absl::StrCat`` or ``absl::StrAppend``. + - New :doc:`abseil-str-cat-append <clang-tidy/checks/abseil-str-cat-append>` check. diff --git a/clang-tools-extra/docs/clang-tidy/checks/abseil-redundant-strcat-calls.rst b/clang-tools-extra/docs/clang-tidy/checks/abseil-redundant-strcat-calls.rst new file mode 100644 index 00000000000..d342bf377eb --- /dev/null +++ b/clang-tools-extra/docs/clang-tidy/checks/abseil-redundant-strcat-calls.rst @@ -0,0 +1,26 @@ +.. title:: clang-tidy - abseil-redundant-strcat-calls + +abseil-redundant-strcat-calls +============================= + +Suggests removal of unnecessary calls to ``absl::StrCat`` when the result is +being passed to another call to ``absl::StrCat`` or ``absl::StrAppend``. + +The extra calls cause unnecessary temporary strings to be constructed. Removing +them makes the code smaller and faster. + +Examples: + +.. code-block:: c++ + + std::string s = absl::StrCat("A", absl::StrCat("B", absl::StrCat("C", "D"))); + //before + + std::string s = absl::StrCat("A", "B", "C", "D"); + //after + + absl::StrAppend(&s, absl::StrCat("E", "F", "G")); + //before + + absl::StrAppend(&s, "E", "F", "G"); + //after diff --git a/clang-tools-extra/docs/clang-tidy/checks/list.rst b/clang-tools-extra/docs/clang-tidy/checks/list.rst index bde9285fb6a..35deccd8e96 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/list.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/list.rst @@ -7,6 +7,7 @@ Clang-Tidy Checks abseil-duration-division abseil-faster-strsplit-delimiter abseil-no-namespace + abseil-redundant-strcat-calls abseil-string-find-startswith abseil-str-cat-append android-cloexec-accept |