alexfh added a comment.

The check seems reasonable, I'm surprised there's no warning in Clang that 
catches index[array] syntax ;)

A few comments re: implementation.


================
Comment at: clang-tidy/readability/MisplacedArrayIndexCheck.cpp:43
@@ +42,3 @@
+
+static StringRef getAsString(const MatchFinder::MatchResult &Result,
+                             const Expr *E) {
----------------
Looks like this repeats getText from clang/Tooling/FixIt.h.

================
Comment at: clang-tidy/readability/MisplacedArrayIndexCheck.cpp:73
@@ +72,3 @@
+
+  D << 
FixItHint::CreateReplacement(ArraySubscriptE->getLHS()->getSourceRange(),
+                                    RHSString);
----------------
Looks like you could use createReplacement and/or getText from 
clang/Tooling/FixIt.h.


http://reviews.llvm.org/D21134



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to