[PATCH] D67135: [clang-tidy] performance-inefficient-vector-operation: Support proto repeated field

Cong Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 4 13:37:27 PDT 2019


congliu updated this revision to Diff 218782.
congliu added a comment.

Updated option descriptions.


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

https://reviews.llvm.org/D67135

Files:
  clang-tools-extra/docs/clang-tidy/checks/performance-inefficient-vector-operation.rst


Index: clang-tools-extra/docs/clang-tidy/checks/performance-inefficient-vector-operation.rst
===================================================================
--- clang-tools-extra/docs/clang-tidy/checks/performance-inefficient-vector-operation.rst
+++ clang-tools-extra/docs/clang-tidy/checks/performance-inefficient-vector-operation.rst
@@ -6,9 +6,9 @@
 Finds possible inefficient ``std::vector`` operations (e.g. ``push_back``,
 ``emplace_back``) that may cause unnecessary memory reallocations.
 
-When EnableProto, also finds calls that add element to protobuf repeated field
-in a loop without calling Reserve() before the loop. Calling Reserve() first
-can avoid unnecessary memory reallocations.
+It can also find calls that add element to protobuf repeated field in a loop
+without calling Reserve() before the loop. Calling Reserve() first can avoid
+unnecessary memory reallocations.
 
 Currently, the check only detects following kinds of loops with a single
 statement body:
@@ -58,3 +58,8 @@
 
    Semicolon-separated list of names of vector-like classes. By default only
    ``::std::vector`` is considered.
+
+.. option:: EnableProto
+   When non-zero, the check will also warn on inefficient operations for proto
+   repeated fields. Otherwise, the check only warns on inefficient vector
+   operations. Default is `0`.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67135.218782.patch
Type: text/x-patch
Size: 1339 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190904/cc790c56/attachment.bin>


More information about the cfe-commits mailing list