[PATCH] D54349: [clang-tidy] new check 'readability-redundant-preprocessor'
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 14 11:03:17 PST 2018
aaron.ballman added inline comments.
================
Comment at: clang-tidy/readability/RedundantPreprocessorCheck.cpp:37
+ CheckMacroRedundancy(Loc, Condition, IfStack,
+ "nested redundant if; consider removing it",
+ "previous if was here", true);
----------------
I think these diagnostics should be hoisted as private constant members of the class. Something like:
`nested redundant %select{#if|#ifdef|#ifndef}0; consider removing it"` and `previous %select{#if|#ifdef|#ifndef}0 here`
================
Comment at: test/clang-tidy/readability-redundant-preprocessor.cpp:45
+// CHECK-NOTES: [[@LINE+1]]:2: warning: nested redundant if; consider removing it [readability-redundant-preprocessor]
+#if FOO == 4
+// CHECK-NOTES: [[@LINE-3]]:2: note: previous if was here
----------------
Can you add a test like `#if FOO == 3 + 1` as well?
https://reviews.llvm.org/D54349
More information about the cfe-commits
mailing list