[PATCH] D124500: [clang-tidy] Support expressions of literals in modernize-macro-to-enum

Richard via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 26 20:29:31 PDT 2022


LegalizeAdulthood created this revision.
LegalizeAdulthood added a reviewer: aaron.ballman.
Herald added subscribers: carlosgalvezp, xazax.hun, mgorny.
Herald added a project: All.
LegalizeAdulthood requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.

Add a recursive descent parser to match macro expansion tokens against
fully formed valid expressions of integral literals.  Partial expressions will
not be matched -- they can't be valid initializing expressions for an enum.

Fixes #55055


https://reviews.llvm.org/D124500

Files:
  clang-tools-extra/clang-tidy/modernize/CMakeLists.txt
  clang-tools-extra/clang-tidy/modernize/IntegralLiteralExpressionMatcher.cpp
  clang-tools-extra/clang-tidy/modernize/IntegralLiteralExpressionMatcher.h
  clang-tools-extra/clang-tidy/modernize/MacroToEnumCheck.cpp
  clang-tools-extra/test/clang-tidy/checkers/modernize-macro-to-enum.cpp
  clang-tools-extra/unittests/clang-tidy/CMakeLists.txt
  clang-tools-extra/unittests/clang-tidy/ModernizeModuleTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124500.425407.patch
Type: text/x-patch
Size: 21558 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220427/211c9921/attachment-0001.bin>


More information about the cfe-commits mailing list