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

Samuel Benzaquen via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 12 14:33:01 PDT 2015


sbenza added inline comments.

================
Comment at: clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp:29
@@ +28,3 @@
+      implicitCastExpr(unless(hasParent(arraySubscriptExpr())),
+                       unless(hasSourceExpression(declRefExpr(to(varDecl(hasName("__range")))))),
+                       unless(hasSourceExpression(stringLiteral()))
----------------
__range is an implementation detail and should not be used here.
Check that this is the range init of a cxxForRangeStmt parent node or something like that.

================
Comment at: test/clang-tidy/cppcoreguidelines-pro-bounds-array-to-pointer-decay.cpp:12
@@ +11,3 @@
+  pointerfun((int*)a);
+  // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: do not (implicitly) convert an array to a pointer
+  arrayfun(a);
----------------
this is not implicit. Is the 'implicit' optional?


http://reviews.llvm.org/D13640





More information about the cfe-commits mailing list