[all-commits] [llvm/llvm-project] 08881c: [clang-tidy] Improve macro handling in modernize-m...

Richard Thomson via All-commits all-commits at lists.llvm.org
Tue Apr 19 21:05:34 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 08881c2de66b267446f01b908ea2e7297bdf3083
      https://github.com/llvm/llvm-project/commit/08881c2de66b267446f01b908ea2e7297bdf3083
  Author: Richard <legalize at xmission.com>
  Date:   2022-04-19 (Tue, 19 Apr 2022)

  Changed paths:
    M clang-tools-extra/clang-tidy/modernize/MacroToEnumCheck.cpp
    M clang-tools-extra/test/clang-tidy/checkers/modernize-macro-to-enum.cpp

  Log Message:
  -----------
  [clang-tidy] Improve macro handling in modernize-macro-to-enum

When a macro is undef'ed or used in a preprocessor conditional
expression, we need to remember that macro should it later be
defined in the file to an integral value.  We need to exclude
such macro names from being turned into an enum.

Maintain a blacklist of identifiers that we've seen in an
undef or conditional preprocessor directive.  When the file is
done processing, remove all the blacklisted identifiers from
conversion to an enum.

Differential Revision: https://reviews.llvm.org/D123889

Fixes #54842




More information about the All-commits mailing list