[PATCH] D145617: [clang-tidy] Add readability-avoid-unconditional-preprocessor-if check

Eugene Zelenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 8 18:40:22 PST 2023


Eugene.Zelenko added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/readability/AvoidUnconditionalPreprocessorIfCheck.cpp:29
+      return;
+    auto &SM = PP.getSourceManager();
+    if (!isStatic(SM, PP.getLangOpts(), ConditionRange))
----------------
Please don't use `auto` unless type is spelled explicitly in same statement or iterator.


================
Comment at: clang-tools-extra/clang-tidy/readability/AvoidUnconditionalPreprocessorIfCheck.cpp:43
+                SourceRange ConditionRange) {
+
+    SourceLocation Loc = ConditionRange.getBegin();
----------------
Excessive newline.


================
Comment at: clang-tools-extra/docs/ReleaseNotes.rst:127
+  Check flags always enabled or disabled code blocks in preprocessor ``#if``
+  conditions, such as ``#if 0`` and ``#if 1``.
+
----------------
Add `etc.` at the end?


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/readability/avoid-unconditional-preprocessor-if.rst:7
+Check flags always enabled or disabled code blocks in preprocessor ``#if``
+conditions, such as ``#if 0`` and ``#if 1``.
+
----------------
Ditto.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145617



More information about the cfe-commits mailing list