llvm/clang-tools-extra/test
Richard f547fc89c0 [clang-tidy] Add modernize-macro-to-enum check
[buildbot issues fixed]

This check performs basic analysis of macros and replaces them
with an anonymous unscoped enum.  Using an unscoped anonymous enum
ensures that everywhere the macro token was used previously, the
enumerator name may be safely used.

Potential macros for replacement must meet the following constraints:
- Macros must expand only to integral literal tokens.  The unary
  operators plus, minus and tilde are recognized to allow for positive,
  negative and bitwise negated integers.
- Macros must be defined on sequential source file lines, or with
  only comment lines in between macro definitions.
- Macros must all be defined in the same source file.
- Macros must not be defined within a conditional compilation block.
- Macros must not be defined adjacent to other preprocessor directives.
- Macros must not be used in preprocessor conditions

Each cluster of macros meeting the above constraints is presumed to
be a set of values suitable for replacement by an anonymous enum.
From there, a developer can give the anonymous enum a name and
continue refactoring to a scoped enum if desired.  Comments on the
same line as a macro definition or between subsequent macro definitions
are preserved in the output.  No formatting is assumed in the provided
replacements.

The check cppcoreguidelines-macro-to-enum is an alias for this check.

Fixes #27408

Differential Revision: https://reviews.llvm.org/D117522
2022-04-01 15:24:21 -06:00
..
clang-apply-replacements
clang-change-namespace
clang-doc
clang-include-fixer
clang-move
clang-query
clang-reorder-fields Use function prototypes when appropriate; NFC 2022-02-25 09:08:27 -05:00
clang-tidy [clang-tidy] Add modernize-macro-to-enum check 2022-04-01 15:24:21 -06:00
modularize
pp-trace
Unit [CMake] Rename TARGET_TRIPLE to LLVM_TARGET_TRIPLE 2022-03-11 15:43:01 -08:00
.clang-format
CMakeLists.txt [clang-tidy] Fix the condition for building CTTestTidyModule 2022-03-25 21:22:46 +02:00
lit.cfg.py [clang-tools-extra] Reuse llvm_config.use_clang() to set up test environment 2022-03-15 22:14:24 +01:00
lit.site.cfg.py.in [cmake] Provide CURRENT_TOOLS_DIR centrally, replacing CLANG_TOOLS_DIR 2022-03-25 20:22:01 +01:00