[PATCH] D13640: [clang-tidy] Add new check cppcoreguidelines-pro-bounds-array-to-pointer-decay

Manuel Klimek via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 13 07:32:14 PDT 2015


klimek added inline comments.

================
Comment at: clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp:40
@@ +39,3 @@
+
+  diag(MatchedCast->getExprLoc(), "do not (implicitly) convert an array to a pointer");
+}
----------------
aaron.ballman wrote:
> klimek wrote:
> > Can't we provide a fixit?
> I think the fixit that the C++ Core Guidelines wants is to use array_view, which isn't available to everyone and can't be applied locally (for instance, it may require changing a function parameter instead of the argument passed to the function).
https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#-bounds3-no-array-to-pointer-decay
says that &a[0] is an OK work around (makes the thing visible)


http://reviews.llvm.org/D13640





More information about the cfe-commits mailing list