[PATCH] D144522: [clang-tidy] Add readability-operators-representation check

Piotr Zegar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 22 14:55:25 PST 2023


PiotrZSL created this revision.
Herald added subscribers: carlosgalvezp, xazax.hun.
Herald added a reviewer: njames93.
Herald added a project: All.
PiotrZSL added a comment.
PiotrZSL updated this revision to Diff 499306.
Eugene.Zelenko added reviewers: aaron.ballman, carlosgalvezp.
PiotrZSL marked 4 inline comments as done.
PiotrZSL updated this revision to Diff 499622.
PiotrZSL updated this revision to Diff 499626.
PiotrZSL published this revision for review.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.

TODO: Tests still need to be extended to cover conversion of all operators in both direction.


PiotrZSL added a comment.

list.rst correction


Eugene.Zelenko added a comment.

Actually https://github.com/llvm/llvm-project/issues/25569 is exactly about this :-)


PiotrZSL added a comment.

Update tests + change config


PiotrZSL added a comment.

This check replaces D31308 <https://reviews.llvm.org/D31308> and D107294 <https://reviews.llvm.org/D107294>.


PiotrZSL added a comment.

Style fixes


PiotrZSL added a comment.

Ready for review



================
Comment at: clang-tools-extra/clang-tidy/readability/OperatorsRepresentationCheck.cpp:16
+#include <array>
+#include <string.h>
+#include <utility>
----------------
`cstring`, please.


================
Comment at: clang-tools-extra/clang-tidy/readability/OperatorsRepresentationCheck.cpp:29
+
+  auto &SourceManager = Context.getSourceManager();
+
----------------
Please don't use `auto` unless type is spelled explicidly in same statement or iterator.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/readability/operators-representation.rst:154
+**Unlock the Power of Clarity - Enforce Alternative Token Representation with
+Clang-Tidy for Crisp and Consistent Code!**
+
----------------
`Clang-tidy`.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/readability/operators-representation.rst:159
+-------
+
+
----------------
Excessive newline.


Check helps enforce consistent token representation for binary, unary and
overloaded operators in C++ code. The check supports both traditional and
alternative representations of operators.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D144522

Files:
  clang-tools-extra/clang-tidy/readability/CMakeLists.txt
  clang-tools-extra/clang-tidy/readability/OperatorsRepresentationCheck.cpp
  clang-tools-extra/clang-tidy/readability/OperatorsRepresentationCheck.h
  clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/docs/clang-tidy/checks/list.rst
  clang-tools-extra/docs/clang-tidy/checks/readability/operators-representation.rst
  clang-tools-extra/test/clang-tidy/checkers/readability/operators-representation-to-alternative.cpp
  clang-tools-extra/test/clang-tidy/checkers/readability/operators-representation-to-traditional.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144522.499626.patch
Type: text/x-patch
Size: 44721 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230222/2faff482/attachment-0001.bin>


More information about the cfe-commits mailing list