[PATCH] D49918: [clang-tidy] Sequence declaration in while statement before the condition

Martin Böhme via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 31 10:03:11 PDT 2018


mboehme marked an inline comment as done.
mboehme added inline comments.


================
Comment at: clang-tidy/utils/ExprSequence.cpp:147
         return TheIfStmt->getCond();
+    } else if (const auto *TheWhileStmt = dyn_cast<WhileStmt>(Parent)) {
+      // While statement: If a variable is declared inside the condition, the
----------------
aaron.ballman wrote:
> Should we also handle switch statements at the same time?
Good point.

While I was doing this, I noticed that we were also not sequencing init statements in if statements correctly, so I've added code for that as well.

The description of the change is now too narrow, so I'll change that in a moment.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D49918





More information about the cfe-commits mailing list