[PATCH] D21134: clang-tidy: new check readability-misplaced-array-index
Daniel Marjamäki via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 9 06:00:39 PDT 2016
danielmarjamaki marked 2 inline comments as done.
Comment at: test/clang-tidy/readability-misplaced-array-index.cpp:31
@@ +30,3 @@
+ x = 0;
+ dostuff(0[0 + ABC]);
> Why is this considered to be "normal syntax" and not worth getting a diagnostic?
hmm.. I agree that it would be good to have a diagnostic for this code also.
I currently only diagnose when subscript is stringLiteral, declRefExpr or memberExpr. These are the cases when the code can be easily fixed by just replacing the expressions.
I will look into writing a diagnostic for this also.
More information about the cfe-commits