[PATCH] D72553: [clang-tidy] Add llvm-prefer-preincrement check

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 10 20:00:19 PST 2020


njames93 created this revision.
njames93 added reviewers: aaron.ballman, alexfh, hokein.
njames93 added projects: clang, clang-tools-extra.
Herald added subscribers: xazax.hun, mgorny.

Adds a new clang-tidy check that detects postfix increments and decrements that can be swapped for their prefix counterparts. Tried to be as thorough as possible with detecting if the result of the operation is used by a parent. I ran this check over llvm and clang lib and the result would build OK.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D72553

Files:
  clang-tools-extra/clang-tidy/llvm/CMakeLists.txt
  clang-tools-extra/clang-tidy/llvm/LLVMTidyModule.cpp
  clang-tools-extra/clang-tidy/llvm/PreferPreincrementCheck.cpp
  clang-tools-extra/clang-tidy/llvm/PreferPreincrementCheck.h
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/docs/clang-tidy/checks/list.rst
  clang-tools-extra/docs/clang-tidy/checks/llvm-prefer-preincrement.rst
  clang-tools-extra/test/clang-tidy/checkers/llvm-prefer-preincrement-disable-cpp-opcalls.cpp
  clang-tools-extra/test/clang-tidy/checkers/llvm-prefer-preincrement.c
  clang-tools-extra/test/clang-tidy/checkers/llvm-prefer-preincrement.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72553.237480.patch
Type: text/x-patch
Size: 20983 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200111/de6420df/attachment-0001.bin>


More information about the cfe-commits mailing list