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

Alexander Kornienko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 7 08:15:00 PST 2019


alexfh added a comment.

One random late comment.



================
Comment at: clang-tools-extra/trunk/test/clang-tidy/abseil-duration-factory-scale.cpp:38
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use ZeroDuration() for zero-length time intervals [abseil-duration-factory-scale]
+  // CHECK-FIXES: absl::ZeroDuration();
+  d = absl::Seconds(int64_t{0});
----------------
I'd add more context to the CHECK-FIXES patterns, otherwise they are not very reliable. There's no implicit connection to the line numbers, so any long enough subsequence of lines containing 'absl::ZeroDuration()' would satisfy the test. One way to do that is to declare variables with unique names. Another is to add unique comments.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D56012





More information about the llvm-commits mailing list