[PATCH] D56012: [clang-tidy] Be more liberal about literal zeroes in abseil checks

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 21 12:08:10 PST 2018


aaron.ballman added inline comments.


================
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,
----------------
Spurious parens can be removed.


================
Comment at: test/clang-tidy/abseil-duration-factory-scale.cpp:3
 
+#include <stdint.h>
 #include "absl/time/time.h"
----------------
Eugene.Zelenko wrote:
> cstdint, please.
Rather than write this as an include, I'd rather just do: `namespace std { typedef long long int64_t; } using int64_t = std::int64_t;` Then there's no question about whether this is using the host stdint.h or the current-clang-stdint.h.


================
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]
----------------
Do you also have users doing something like: `absl::Seconds(int{});`?


Repository:
  rCTE Clang Tools Extra

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56012/new/

https://reviews.llvm.org/D56012





More information about the cfe-commits mailing list