[PATCH] D54349: [clang-tidy] new check 'readability-redundant-preprocessor'
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 9 16:25:04 PST 2018
aaron.ballman added a comment.
What do you think about code like:
#if FOO == 4
#if FOO == 4
#endif
#endif
#if defined(FOO)
#if defined(FOO)
#endif
#endif
#if !defined(FOO)
#if !defined(FOO)
#endif
#endif
#if defined(FOO)
#if !defined(FOO)
#endif
#endif
#if !defined(FOO)
#if defined(FOO)
#endif
#endif
================
Comment at: clang-tidy/readability/CMakeLists.txt:23
ReadabilityTidyModule.cpp
+ RedundantPreprocessorCheck.cpp
RedundantControlFlowCheck.cpp
----------------
Please keep this list sorted alphabetically.
================
Comment at: clang-tidy/readability/RedundantPreprocessorCheck.cpp:52
+private:
+ void Startif(SourceLocation Loc, const Token &MacroNameTok,
+ SmallVector<Entry, 4> &Stack, StringRef Warning,
----------------
This name is not particularly descriptive. This seems to be more like `CheckMacroRedundancy` or something like that?
================
Comment at: clang-tidy/readability/RedundantPreprocessorCheck.h:1-2
+//===--- RedundantPreprocessorCheck.h - clang-tidy -----------------------*- C++
+//-*-===//
+//
----------------
This comment should be re-flowed to fit the column width.
================
Comment at: clang-tidy/readability/RedundantPreprocessorCheck.h:20
+
+/// This check flags redundant preprocessor usage.
+///
----------------
What constitutes "redundancy"? A bit more exposition here would be useful.
https://reviews.llvm.org/D54349
More information about the cfe-commits
mailing list