[PATCH] D53830: [clang-tidy]: Abseil: new check 'abseil-upgrade-duration-conversions'

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 31 12:52:31 PDT 2018


aaron.ballman added inline comments.


================
Comment at: clang-tidy/abseil/UpgradeDurationConversionsCheck.cpp:151-152
+  const auto *ArgExpr = Result.Nodes.getNodeAs<Expr>("arg");
+  llvm::StringRef Message = "perform explicit cast on expression getting "
+                            "implicitly converted to int64_t";
+
----------------
How about: `"implicit conversion to 'int64_t' is deprecated in this context; use an explicit cast instead"`


================
Comment at: docs/clang-tidy/checks/abseil-upgrade-duration-conversions.rst:16
+Additionally, the ``absl::Duration`` factory functions (``absl::Hours``,
+``absl::Minutes``, etc) currently accept an ``int64_t`` or a floating point
+type. Similar to the arithmetic operators, calls with an argument of class type
----------------
floating point -> floating-point


================
Comment at: docs/clang-tidy/checks/abseil-upgrade-duration-conversions.rst:22
+prevent unintended behavior. Passing an argument of class type will result in
+compile error, even if the type is implicitly convertible to an arithmetic type.
+
----------------
compile error -> a diagnostic


================
Comment at: docs/clang-tidy/checks/abseil-upgrade-duration-conversions.rst:42
+current behavior of user code. It is possible that this uncovers unintended
+behavior due to types implicitly convertible to a floating point type.
----------------
floating point -> floating-point


https://reviews.llvm.org/D53830





More information about the cfe-commits mailing list