[PATCH] D54246: [clang-tidy] Add the abseil-duration-factory-scale check

Hyrum Wright via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 16 12:59:59 PST 2018


hwright marked 5 inline comments as done.
hwright added inline comments.


================
Comment at: clang-tidy/abseil/DurationFactoryScaleCheck.cpp:73
+  case DurationScale::Hours:
+    if (Multiplier <= 1.0 / 60.0)
+      return std::make_tuple(DurationScale::Minutes, Multiplier * 60.0);
----------------
aaron.ballman wrote:
> This doesn't seem quite right. `1.0/6000.0` is less than `1.0/60.0` but isn't a `Minutes` scaling.
After spending two days chasing this down, it finally occurred to me: we don't actually handle this case.  Our (somewhat conservative) matchers only look for literal values, not division expressions like `1.0/60.0`.

And for this iteration of the tool, I think I'm fine with that, since I expect those kinds of things to be exceedingly rare, and probably tricky to handle, anyway.


https://reviews.llvm.org/D54246





More information about the cfe-commits mailing list