alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.
Looks good with one comment.
Thank you!
================
Comment at:
clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp:107
@@ +106,3 @@
+ diag(Matched->getExprLoc(),
+ "array index %0 is before the beginning of the array")
+ << Index.toString(10);
----------------
To avoid confusion, I suggest explicitly stating that this is an std::array,
not a regular array ("std::array<> index %0 is before ..."). Same for the
message below.
Also, it's fine to have this in clang-tidy for now, but ultimately, it may be
reasonable and more consistent to analyze this in Clang as a part of
-Warray-bounds. However, I'm not sure whether it's better to make a
library-specific warning in Clang or introduce some annotation to tell the
compiler that it can statically check indexes using a certain expression, for
example.
http://reviews.llvm.org/D13746
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits