[PATCH] D131939: [clang-tidy] Add performance-expensive-flat-container-operation check

Nicolas van Kempen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 16 08:41:01 PDT 2022


nicovank created this revision.
Herald added subscribers: carlosgalvezp, xazax.hun, mgorny.
Herald added a project: All.
nicovank edited the summary of this revision.
nicovank edited the summary of this revision.
nicovank updated this revision to Diff 452886.
nicovank updated this revision to Diff 452894.
nicovank added a comment.
nicovank updated this revision to Diff 452896.
Eugene.Zelenko added reviewers: alex, aaron.ballman, njames93, LegalizeAdulthood.
Eugene.Zelenko added a project: clang-tools-extra.
nicovank updated this revision to Diff 453026.
nicovank marked an inline comment as done.
nicovank published this revision for review.
nicovank added subscribers: marksantaniello, ivanmurashko, 0x1eaf.
nicovank marked an inline comment as done.
Herald added a subscriber: cfe-commits.

Rename second test file


nicovank added a comment.

Add isLanguageVersionSupported.



================
Comment at: clang-tools-extra/clang-tidy/performance/ExpensiveFlatContainerOperationCheck.h:31
+  void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
+
+private:
----------------
Please add `isLanguageVersionSupported`.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/performance/expensive-flat-container-operation.rst:6
+
+This check operates on vector-based containers such as
+``boost::container::flat_(map|set)`` and ``folly::sorted_vector_(map|set)``.
----------------
Please synchronize first statement with Release Notes.


This check has been enabled internally at Facebook for a few months now (with `OnlyWarnInLoops` disabled), where `folly::sorted_vector_map` is pretty widely used.

I saw `std::flat_(map|set)` and `std::flat_multi(map|set)` will appear in C++23, at which point this check can be updated to include these.

`folly::heap_vector_(map|set)` is another example of such containers, though still relatively new so not included here yet.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D131939

Files:
  clang-tools-extra/clang-tidy/performance/CMakeLists.txt
  clang-tools-extra/clang-tidy/performance/ExpensiveFlatContainerOperationCheck.cpp
  clang-tools-extra/clang-tidy/performance/ExpensiveFlatContainerOperationCheck.h
  clang-tools-extra/clang-tidy/performance/PerformanceTidyModule.cpp
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/docs/clang-tidy/checks/list.rst
  clang-tools-extra/docs/clang-tidy/checks/performance/expensive-flat-container-operation.rst
  clang-tools-extra/test/clang-tidy/checkers/performance/expensive-flat-container-operation-only-warn-in-loops.cpp
  clang-tools-extra/test/clang-tidy/checkers/performance/expensive-flat-container-operation.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131939.453026.patch
Type: text/x-patch
Size: 31605 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220816/080c3891/attachment-0001.bin>


More information about the cfe-commits mailing list