[PATCH] D43745: Fix cppcoreguidelines-pro-bounds-pointer-arithmetic not working for functions with auto return specifier.
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 1 10:13:21 PST 2018
aaron.ballman added a comment.
Some minor formatting nits, but otherwise LGTM. You should run the patch through clang-format: https://clang.llvm.org/docs/ClangFormat.html#script-for-patch-reformatting
================
Comment at: clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.cpp:29
hasOperatorName("+="), hasOperatorName("-=")),
- hasType(pointerType()),
+ anyOf(hasType(pointerType()), hasType(autoType(hasDeducedType(pointerType())))),
unless(hasLHS(ignoringImpCasts(declRefExpr(to(isImplicit()))))))
----------------
This extends past the 80-col limit.
================
Comment at: test/clang-tidy/cppcoreguidelines-pro-bounds-pointer-arithmetic.cpp:12
+int* pointer() {
+ return nullptr;
----------------
Should be `int *` instead of `int*` (elsewhere as well).
================
Comment at: test/clang-tidy/cppcoreguidelines-pro-bounds-pointer-arithmetic.cpp:26
+ auto x = (int*) nullptr;
+ p = x + 1;
+ // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: do not use pointer arithmetic
----------------
Can you remove the whitespace alignment from the new tests?
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D43745
More information about the cfe-commits
mailing list