[PATCH] D18766: [clang-tidy] Add check misc-multiple-statement-macro
Haojian Wu via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 5 03:12:43 PDT 2016
hokein added a comment.
Nice check! I like the check, it would be very helpful. (I have struggled with this kind of bug before)
================
Comment at: clang-tidy/misc/MultipleStatementMacroCheck.cpp:33
@@ +32,3 @@
+
+namespace {
+
----------------
I think you can put this anonymous namespace into the above one.
================
Comment at: clang-tidy/misc/MultipleStatementMacroCheck.cpp:37
@@ +36,3 @@
+const Stmt *nextStmt(const MatchFinder::MatchResult &Result, const Stmt *S) {
+ const Stmt *Parent = Result.Context->getParents(*S)[0].get<Stmt>();
+ if (!Parent)
----------------
Should we check the result returned by `Result.Context->getParents` is valid or not?
================
Comment at: docs/clang-tidy/checks/misc-multiple-statement-macro.rst:15
@@ +14,3 @@
+ if (do_increment)
+ INCREMENT_TWO(a, b);
+
----------------
Would be better to add a comment to explain the sample.
http://reviews.llvm.org/D18766
More information about the cfe-commits
mailing list