Previously, we'd only match on literal floating or integral zeroes, but I've now also learned that some users spell that value as int{0} or float{0}, which also need to be matched.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
test/clang-tidy/abseil-duration-factory-scale.cpp | ||
---|---|---|
3 ↗ | (On Diff #179306) | cstdint, please. |
clang-tidy/abseil/DurationRewriter.cpp | ||
---|---|---|
110 ↗ | (On Diff #179306) | Spurious parens can be removed. |
test/clang-tidy/abseil-duration-factory-scale.cpp | ||
3 ↗ | (On Diff #179306) | 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. |
34 ↗ | (On Diff #179306) | Do you also have users doing something like: absl::Seconds(int{});? |
btw, I think hasInit should probably be moved into the core set of matchers at some point.
clang-tidy/abseil/DurationRewriter.cpp | ||
---|---|---|
110 ↗ | (On Diff #179306) | Done. (Though there are similar parens in the implementation of hasArgument. :) |
test/clang-tidy/abseil-duration-factory-scale.cpp | ||
34 ↗ | (On Diff #179306) | I have not yet seen that. |
One random late comment.
clang-tools-extra/trunk/test/clang-tidy/abseil-duration-factory-scale.cpp | ||
---|---|---|
38 | 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. |
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.