[PATCH] D29692: [clang-tidy] add check modernize-use-const-instead-of-define

Alexander Lanin via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 7 16:22:54 PST 2017


AlexanderLanin created this revision.
Herald added subscribers: JDevlieghere, mgorny.

Suggestion for a new check that will warn on #defines that should rather be constant values. Const variables should be preferred  as #define does not obey type checking and scope rules.

Please feel free to criticize as strict as you like, this is my very first patch to llvm/clang. Also I'm not sure about the check name itself...


https://reviews.llvm.org/D29692

Files:
  clang-tidy/modernize/CMakeLists.txt
  clang-tidy/modernize/ModernizeTidyModule.cpp
  clang-tidy/modernize/UseConstInsteadOfDefineCheck.cpp
  clang-tidy/modernize/UseConstInsteadOfDefineCheck.h
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/modernize-use-const-instead-of-define.rst
  test/clang-tidy/modernize-use-const-instead-of-define.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29692.87559.patch
Type: text/x-patch
Size: 10447 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170208/de377c53/attachment-0001.bin>


More information about the cfe-commits mailing list