[PATCH] D117522: [clang-tidy] Add modernize-macro-to-enum check

Richard via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 17 20:54:10 PST 2022


LegalizeAdulthood added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/modernize/MacroToEnumCheck.cpp:182
+      MD->getMacroInfo()->isUsedForHeaderGuard() ||
+      MD->getMacroInfo()->isBuiltinMacro() || ConditionScope > 0)
+    return;
----------------
LegalizeAdulthood wrote:
> njames93 wrote:
> > This `ConditionScope` checks looks like it would prevent warning in header files that use a header guard(instead of pragma once) to prevent multiple inclusion.
> Oh, good catch, you're probably right.  I'll test that manually.
> 
> (Gee, another case where we need `check_clang_tidy.py` to validate
> changes to header files!  This keeps coming up!  My implementation
> of this from several years ago died in review hell and was never born.)
Any ideas for an algorithm that detects a header guard condition
from some other condition?  I don't see anything obvious.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117522/new/

https://reviews.llvm.org/D117522



More information about the cfe-commits mailing list