[PATCH] D56012: [clang-tidy] Be more liberal about literal zeroes in abseil checks
Hyrum Wright via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 21 12:59:16 PST 2018
hwright added a comment.
btw, I think `hasInit` should probably be moved into the core set of matchers at some point.
================
Comment at: clang-tidy/abseil/DurationRewriter.cpp:110
+ ast_matchers::internal::Matcher<Expr>, InnerMatcher) {
+ return (N < Node.getNumInits() &&
+ InnerMatcher.matches(*Node.getInit(N)->IgnoreParenImpCasts(), Finder,
----------------
aaron.ballman wrote:
> Spurious parens can be removed.
Done. (Though there are similar parens in the implementation of `hasArgument`. :)
================
Comment at: test/clang-tidy/abseil-duration-factory-scale.cpp:34
// CHECK-FIXES: absl::ZeroDuration();
+ d = absl::Seconds(int{0});
+ // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use ZeroDuration() for zero-length time intervals [abseil-duration-factory-scale]
----------------
aaron.ballman wrote:
> Do you also have users doing something like: `absl::Seconds(int{});`?
I have not yet seen that.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D56012/new/
https://reviews.llvm.org/D56012
More information about the cfe-commits
mailing list