[PATCH] D123479: [clang-tidy] Support parenthesized literals in modernize-macro-to-enum

Richard via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 10 20:36:29 PDT 2022


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

When scanning a macro expansion to examine it as a candidate enum,
first strip off arbitrary matching parentheses from the outside in,
then examine what remains to see if it is Lit, +Lit, -Lit or ~Lit.
If not, reject it as a possible enum candidate.

Fixes #54843


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D123479

Files:
  clang-tools-extra/clang-tidy/modernize/MacroToEnumCheck.cpp
  clang-tools-extra/docs/clang-tidy/checks/modernize-macro-to-enum.rst
  clang-tools-extra/test/clang-tidy/checkers/modernize-macro-to-enum.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123479.421826.patch
Type: text/x-patch
Size: 6453 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220411/bb2544ff/attachment-0001.bin>


More information about the cfe-commits mailing list