[PATCH] D59183: [clang-tidy] Expand cases covered by the abseil-duration-unnecessary-conversion check

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 12 02:18:57 PDT 2019


hokein added inline comments.


================
Comment at: clang-tidy/abseil/DurationUnnecessaryConversionCheck.cpp:31
 
+    auto factory_matcher = cxxConstructExpr(hasArgument(
+        0,
----------------
could you add a few comment briefly describing these matchers?


================
Comment at: test/clang-tidy/abseil-duration-unnecessary-conversion.cpp:48
 
+  d2 = absl::Hours(d1 / absl::Hours(1));
+  // CHECK-MESSAGES: [[@LINE-1]]:8: warning: remove unnecessary absl::Duration conversions [abseil-duration-unnecessary-conversion]
----------------
An off-topic comment: do we have this code pattern in the codebase? From my understanding, the usage like this is really rare. 


================
Comment at: test/clang-tidy/abseil-duration-unnecessary-conversion.cpp:50
+  // CHECK-MESSAGES: [[@LINE-1]]:8: warning: remove unnecessary absl::Duration conversions [abseil-duration-unnecessary-conversion]
+  // CHECK-FIXES: d1
+  d2 = absl::Minutes(d1 / absl::Minutes(1));
----------------
could you check the full statement `d2 = d1`?  the same to other places.


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D59183





More information about the cfe-commits mailing list