[PATCH] D32436: [clang-tidy] Support detecting for-range loop in inefficient-vector-operation check.
Alexander Kornienko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 26 09:51:20 PDT 2017
alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.
LG
================
Comment at: clang-tidy/performance/InefficientVectorOperationCheck.cpp:152
+
+ const Stmt * LoopStmt = nullptr;
+ if (ForLoop)
----------------
hokein wrote:
> alexfh wrote:
> > const Stmt *LoopStmt = ForLoop ? ForLoop : RangeLoop;
> We can't do it because `ForLoop` and `RangeLoop` are different types.
Yup, static_cast<Stmt*> would be more ugly. This could still be shortened a bit:
const Stmt *LoopStmt = ForLoop;
if (!LoopStmt)
LoopStmt = RangeLoop;
Not that it makes too much difference though. Up to you.
================
Comment at: clang-tidy/performance/InefficientVectorOperationCheck.cpp:153
+
+ const Stmt * LoopStmt = nullptr;
+ if (ForLoop)
----------------
nit: Please remove the extra space after the asterisk.
https://reviews.llvm.org/D32436
More information about the cfe-commits
mailing list