hwright created this revision.
hwright added reviewers: alexfh, alexfh_.
Herald added a subscriber: mgorny.
This check finds cases where calls to an absl::Duration factory could use the
more efficient integer overload.
For example:
// Original - Providing a floating-point literal.
absl::Duration
hwright updated this revision to Diff 169946.
hwright marked 8 inline comments as done.
hwright added a comment.
Addressed review comments
https://reviews.llvm.org/D53339
Files:
clang-tidy/abseil/AbseilTidyModule.cpp
clang-tidy/abseil/CMakeLists.txt
clang-tidy/abseil/DurationFactoryFloatC
hwright added inline comments.
Comment at: clang-tidy/abseil/DurationFactoryFloatCheck.cpp:27
+ double value = FloatLiteral.getValueAsApproximateDouble();
+ if (std::fmod(value, 1) == 0) {
+bool is_negative = false;
alexfh wrote:
> Probably doesn't matter m
hwright updated this revision to Diff 170083.
hwright marked 6 inline comments as done.
hwright added a comment.
Addressed reviewer comments.
https://reviews.llvm.org/D53339
Files:
clang-tidy/abseil/AbseilTidyModule.cpp
clang-tidy/abseil/CMakeLists.txt
clang-tidy/abseil/DurationFactoryFlo
hwright added inline comments.
Comment at: clang-tidy/abseil/DurationFactoryFloatCheck.cpp:34
+llvm::APSInt ApInt(/*BitWidth=*/64, /*isUnsigned=*/false);
+ApInt = static_cast(value);
+if (is_negative)
JonasToth wrote:
> Wouldn't it make more sense to
hwright added a comment.
Ping.
What are the next steps here?
https://reviews.llvm.org/D53339
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
hwright updated this revision to Diff 170659.
hwright marked 5 inline comments as done.
hwright added a comment.
Address reviewer comments
https://reviews.llvm.org/D53339
Files:
clang-tidy/abseil/AbseilTidyModule.cpp
clang-tidy/abseil/CMakeLists.txt
clang-tidy/abseil/DurationFactoryFloatC
hwright added inline comments.
Comment at: clang-tidy/abseil/DurationFactoryFloatCheck.h:19
+
+/// Prefer integer Duration factories when possible.
+///
JonasToth wrote:
> Please add more to the doc here, like `This check finds ... and transforms
> these calls i
hwright marked 2 inline comments as done.
hwright added a comment.
I do not have commit privileges, so somebody else would need to submit it.
We've had a version of this check running over our internal codebase for
several months with no unexpected problems.
Comment at: clang
hwright marked 4 inline comments as done.
hwright added inline comments.
Comment at: clang-tidy/abseil/DurationFactoryFloatCheck.cpp:36
+
+static bool InsideMacroDefinition(const MatchFinder::MatchResult &Result,
+ SourceRange Range) {
---
hwright updated this revision to Diff 170803.
hwright marked an inline comment as done.
hwright added a comment.
Address reviewer comments.
https://reviews.llvm.org/D53339
Files:
clang-tidy/abseil/AbseilTidyModule.cpp
clang-tidy/abseil/CMakeLists.txt
clang-tidy/abseil/DurationFactoryFloat
hwright updated this revision to Diff 170847.
hwright marked 2 inline comments as done.
hwright added a comment.
Update diagnostic text
https://reviews.llvm.org/D53339
Files:
clang-tidy/abseil/AbseilTidyModule.cpp
clang-tidy/abseil/CMakeLists.txt
clang-tidy/abseil/DurationFactoryFloatChec
hwright added inline comments.
Comment at: clang-tidy/abseil/AbseilTidyModule.cpp:32
+CheckFactories.registerCheck(
+"abseil-duration-factory-float");
CheckFactories.registerCheck(
hokein wrote:
> Maybe drop the `factory`? we already have a durat
hwright updated this revision to Diff 170912.
hwright marked 5 inline comments as done.
hwright added a comment.
Remove full-stop
https://reviews.llvm.org/D53339
Files:
clang-tidy/abseil/AbseilTidyModule.cpp
clang-tidy/abseil/CMakeLists.txt
clang-tidy/abseil/DurationFactoryFloatCheck.cpp
hwright added a comment.
In https://reviews.llvm.org/D53339#1274478, @JonasToth wrote:
> I think accepted now? :)
> If you want I can commit for you and monitor the buildbot, if there are
> bigger problems I would come back to you.
@JonasToth I don't actually have commit privileges, so somebo
hwright updated this revision to Diff 181204.
hwright marked an inline comment as done.
hwright added a comment.
Run `clang-format`
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D56532/new/
https://reviews.llvm.org/D56532
Files:
clang-tidy/abseil/AbseilTidyModule.cpp
clang-tidy/abse
hwright added a comment.
Ping.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D56532/new/
https://reviews.llvm.org/D56532
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
hwright updated this revision to Diff 182043.
hwright marked 6 inline comments as done.
hwright added a comment.
Address reviewer comments
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D56532/new/
https://reviews.llvm.org/D56532
Files:
clang-tidy/abseil/AbseilTidyModule.cpp
clang-ti
hwright added inline comments.
Comment at: clang-tidy/abseil/DurationComparisonCheck.cpp:47-48
// if nothing needs to be done.
- if (!IsValidMacro(Result, Binop->getLHS()) ||
- !IsValidMacro(Result, Binop->getRHS()))
+ if (!isNotInMacro(Result, Binop->getLHS()) ||
+
This revision was automatically updated to reflect the committed changes.
Closed by commit rL351473: [clang-tidy] Add abseil-duration-conversion-cast
check (authored by hwright, committed by ).
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D56532?vs=
hwright created this revision.
hwright added reviewers: hokein, aaron.ballman, JonasToth.
hwright added a project: clang-tools-extra.
Herald added subscribers: cfe-commits, xazax.hun, mgorny.
This is an analog to the existing `abseil-duration-subtraction` check.
Repository:
rCTE Clang Tools Ex
hwright updated this revision to Diff 183531.
hwright added a comment.
Sort release notes
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D57185/new/
https://reviews.llvm.org/D57185
Files:
clang-tidy/abseil/AbseilTidyModule.cpp
clang-tidy/abseil/CMakeLists.txt
clang-tidy/abseil/Dura
hwright updated this revision to Diff 183539.
hwright marked 11 inline comments as done.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D57185/new/
https://reviews.llvm.org/D57185
Files:
clang-tidy/abseil/AbseilTidyModule.cpp
clang-tidy/abseil/CMakeLists.txt
clang-tidy/abseil/Duratio
hwright added inline comments.
Comment at: clang-tidy/abseil/DurationAdditionCheck.cpp:22
+void DurationAdditionCheck::registerMatchers(MatchFinder *Finder) {
+ Finder->addMatcher(
+ binaryOperator(hasOperatorName("+"),
JonasToth wrote:
> This whole file is
hwright marked 2 inline comments as done.
hwright added inline comments.
Comment at: test/clang-tidy/abseil-duration-addition.cpp:84
+#undef PLUS_FIVE
+}
JonasToth wrote:
> a view template test-cases would be good to have.
I'm not sure I know that terminology; do
hwright updated this revision to Diff 183583.
hwright marked an inline comment as done.
hwright added a comment.
Add another test
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D57185/new/
https://reviews.llvm.org/D57185
Files:
clang-tidy/abseil/AbseilTidyModule.cpp
clang-tidy/abseil
This revision was automatically updated to reflect the committed changes.
Closed by commit rL352362: [clang-tidy] Add the abseil-duration-addition check
(authored by hwright, committed by ).
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D57185?vs=183
hwright created this revision.
hwright added reviewers: hokein, JonasToth, aaron.ballman.
hwright added a project: clang-tools-extra.
Herald added subscribers: cfe-commits, xazax.hun, mgorny.
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D57353
Files:
clang-tidy/abseil/AbseilTi
hwright updated this revision to Diff 184143.
hwright marked 5 inline comments as done.
hwright added a comment.
Address reviewer comments.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D57353/new/
https://reviews.llvm.org/D57353
Files:
clang-tidy/abseil/AbseilTidyModule.cpp
clang-t
hwright added inline comments.
Comment at: docs/clang-tidy/checks/abseil-duration-double-conversion.rst:20
+
+
+ // Original - Conversion to integer and back again
Eugene.Zelenko wrote:
> Unnecessary empty line.
This is consistent with other documentation in thi
hwright updated this revision to Diff 184146.
hwright marked 2 inline comments as done.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D57353/new/
https://reviews.llvm.org/D57353
Files:
clang-tidy/abseil/AbseilTidyModule.cpp
clang-tidy/abseil/CMakeLists.txt
clang-tidy/abseil/Duration
hwright added inline comments.
Comment at: docs/clang-tidy/checks/abseil-duration-double-conversion.rst:28
+
+Note: Converting to an integer and back to an `absl::Duration` might be a
+truncating operation if the value is not aligned to the scale of conversion.
E
hwright marked 2 inline comments as done.
hwright added inline comments.
Comment at: docs/clang-tidy/checks/abseil-duration-double-conversion.rst:20
+
+
+ // Original - Conversion to integer and back again
MyDeveloperDay wrote:
> hwright wrote:
> > Eugene.Zelenk
hwright updated this revision to Diff 173166.
hwright marked 4 inline comments as done.
hwright added a comment.
Address reviewer comments
https://reviews.llvm.org/D54246
Files:
clang-tidy/abseil/AbseilTidyModule.cpp
clang-tidy/abseil/CMakeLists.txt
clang-tidy/abseil/DurationFactoryScaleC
hwright added inline comments.
Comment at: clang-tidy/abseil/DurationFactoryScaleCheck.cpp:36
+GetScaleForFactory(llvm::StringRef FactoryName) {
+ static const auto *ScaleMap =
+ new std::unordered_map(
Eugene.Zelenko wrote:
> This will cause memory leaks,
hwright updated this revision to Diff 173543.
hwright marked 16 inline comments as done.
hwright added a comment.
Addressed reviewer feedback.
https://reviews.llvm.org/D54246
Files:
clang-tidy/abseil/AbseilTidyModule.cpp
clang-tidy/abseil/CMakeLists.txt
clang-tidy/abseil/DurationFactorySc
hwright added inline comments.
Comment at: clang-tidy/abseil/DurationFactoryScaleCheck.cpp:74
+ case DurationScale::Minutes:
+if (Multiplier == 60.0)
+ return DurationScale::Hours;
hokein wrote:
> we are comparing with floats, I think we should use some
hwright updated this revision to Diff 173714.
hwright marked 11 inline comments as done.
hwright added a comment.
Addressed small concerns.
Larger issues pending feedback.
https://reviews.llvm.org/D54246
Files:
clang-tidy/abseil/AbseilTidyModule.cpp
clang-tidy/abseil/CMakeLists.txt
clang
hwright added inline comments.
Comment at: clang-tidy/abseil/DurationFactoryScaleCheck.cpp:57-58
+// One and only one of `IntLit` and `FloatLit` should be provided.
+static double GetValue(const IntegerLiteral *IntLit,
+ const FloatingLiteral *FloatLit) {
+
hwright updated this revision to Diff 174039.
hwright marked 11 inline comments as done.
hwright added a comment.
Combined multiplication and division logic, and also now handles scaling of
multiple steps (e.g., Seconds * 3600).
https://reviews.llvm.org/D54246
Files:
clang-tidy/abseil/Abseil
hwright added inline comments.
Comment at: clang-tidy/abseil/DurationFactoryScaleCheck.cpp:57-58
+// One and only one of `IntLit` and `FloatLit` should be provided.
+static double GetValue(const IntegerLiteral *IntLit,
+ const FloatingLiteral *FloatLit) {
+
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);
-
hwright added a comment.
I think this is ready to go, please advise on next steps.
https://reviews.llvm.org/D54246
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
hwright added a comment.
@aaron.ballman I don't actually have the commit bit, can you commit this, or
are we waiting for further review?
https://reviews.llvm.org/D54246
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/c
hwright updated this revision to Diff 175379.
hwright marked 23 inline comments as done.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D54737/new/
https://reviews.llvm.org/D54737
Files:
clang-tidy/abseil/AbseilTidyModule.cpp
clang-tidy/abseil/CMakeLists.txt
clang-tidy/abseil/Duratio
hwright added a comment.
Sorry it's taken so long to get all the feedback addressed!
Comment at: clang-tidy/abseil/DurationComparisonCheck.cpp:25
+static llvm::Optional getScaleForInverse(llvm::StringRef Name) {
+ static const std::unordered_map ScaleMap(
+ {{"ToDoubleHou
hwright added inline comments.
Comment at: clang-tidy/abseil/DurationComparisonCheck.cpp:25
+static llvm::Optional getScaleForInverse(llvm::StringRef Name) {
+ static const std::unordered_map ScaleMap(
+ {{"ToDoubleHours", DurationScale::Hours},
JonasToth w
hwright updated this revision to Diff 175476.
hwright marked 10 inline comments as done.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D54737/new/
https://reviews.llvm.org/D54737
Files:
clang-tidy/abseil/AbseilTidyModule.cpp
clang-tidy/abseil/CMakeLists.txt
clang-tidy/abseil/Duratio
hwright marked 12 inline comments as done.
hwright added inline comments.
Comment at: clang-tidy/abseil/DurationComparisonCheck.cpp:25
+static llvm::Optional getScaleForInverse(llvm::StringRef Name) {
+ static const std::unordered_map ScaleMap(
+ {{"ToDoubleHours", Duration
hwright marked 2 inline comments as done.
hwright added a comment.
Anything else for me here?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D54737/new/
https://reviews.llvm.org/D54737
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
h
hwright updated this revision to Diff 175735.
hwright marked 13 inline comments as done.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D54737/new/
https://reviews.llvm.org/D54737
Files:
clang-tidy/abseil/AbseilTidyModule.cpp
clang-tidy/abseil/CMakeLists.txt
clang-tidy/abseil/Duratio
hwright added inline comments.
Comment at: clang-tidy/abseil/DurationComparisonCheck.cpp:69
+ // We know our map contains all the Scale values, so we can skip the
+ // nonexistence check.
+ auto InverseIter = InverseMap.find(Scale);
JonasToth wrote:
> non-exis
hwright marked 4 inline comments as done.
hwright added inline comments.
Comment at: clang-tidy/abseil/DurationDivisionCheck.h:23
// http://clang.llvm.org/extra/clang-tidy/checks/abseil-duration-division.html
class DurationDivisionCheck : public ClangTidyCheck {
-
hwright marked 4 inline comments as done.
hwright added inline comments.
Comment at: clang-tidy/abseil/DurationFactoryFloatCheck.cpp:61
+
+ if (SimpleArg) {
diag(MatchedCall->getBeginLoc(),
JonasToth wrote:
> hwright wrote:
> > JonasToth wrote:
> > > hwrigh
hwright marked an inline comment as done.
hwright added a comment.
Ping.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D54737/new/
https://reviews.llvm.org/D54737
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/
hwright updated this revision to Diff 176103.
hwright added a comment.
Slightly simplify the fixit text
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D54737/new/
https://reviews.llvm.org/D54737
Files:
clang-tidy/abseil/AbseilTidyModule.cpp
clang-tidy/abseil/CMakeLists.txt
clang-ti
hwright updated this revision to Diff 176156.
hwright marked 2 inline comments as done.
hwright added a comment.
Add additional test
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D54737/new/
https://reviews.llvm.org/D54737
Files:
clang-tidy/abseil/AbseilTidyModule.cpp
clang-tidy/abs
hwright added a comment.
@JonasToth reminder that you (or somebody else) will need to commit this for me.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D54737/new/
https://reviews.llvm.org/D54737
___
cfe-commits mailing list
cfe-commits@list
hwright added a comment.
Oh, and thanks for taking the time to review this. :)
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D54737/new/
https://reviews.llvm.org/D54737
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llv
hwright updated this revision to Diff 176757.
hwright marked an inline comment as done.
hwright added a comment.
Fix double space.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D55245/new/
https://reviews.llvm.org/D55245
Files:
clang-tidy/abseil/AbseilTidyModule.cpp
clang-tidy/absei
hwright added a comment.
Ping.
I assume I've got the right reviewers here, but I've also been sending a bunch
of stuff your way lately, so if I'm overwhelming review capacity, please let me
know.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D55245/new/
https://reviews.llvm.org/D55245
hwright updated this revision to Diff 177266.
hwright marked 8 inline comments as done.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D55245/new/
https://reviews.llvm.org/D55245
Files:
clang-tidy/abseil/AbseilTidyModule.cpp
clang-tidy/abseil/CMakeLists.txt
clang-tidy/abseil/Duration
hwright added inline comments.
Comment at: clang-tidy/abseil/DurationRewriter.cpp:35
+getInverseForScale(DurationScale Scale) {
+ static const std::unordered_map>
lebedev.ri wrote:
> https://llvm.org/docs/ProgrammersManual.html#other-map-like-container-options
>
hwright added inline comments.
Comment at: clang-tidy/abseil/DurationRewriter.cpp:35
+getInverseForScale(DurationScale Scale) {
+ static const std::unordered_map>
lebedev.ri wrote:
> hwright wrote:
> > lebedev.ri wrote:
> > > https://llvm.org/docs/ProgrammersMan
hwright updated this revision to Diff 177325.
hwright marked 7 inline comments as done.
hwright added a comment.
Use an `IndexedMap` instead of an `std::unordered_map`
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D55245/new/
https://reviews.llvm.org/D55245
Files:
clang-tidy/abseil/Ab
hwright added a comment.
Reminder: I'll need somebody to submit this for me, since I don't have
subversion access.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D55245/new/
https://reviews.llvm.org/D55245
___
cfe-commits mailing list
cfe-co
hwright updated this revision to Diff 177509.
hwright marked 5 inline comments as done.
hwright added a comment.
Use `static_cast` instead of a `switch` for `IndexedMap` lookup.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D55245/new/
https://reviews.llvm.org/D55245
Files:
clang-tidy
hwright added inline comments.
Comment at: clang-tidy/abseil/DurationRewriter.cpp:20-39
+struct DurationScale2IndexFunctor {
+ using argument_type = DurationScale;
+ unsigned operator()(DurationScale Scale) const {
+switch (Scale) {
+case DurationScale::Hours:
+ re
hwright updated this revision to Diff 177590.
hwright marked 9 inline comments as done.
hwright added a comment.
Add tests
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D55245/new/
https://reviews.llvm.org/D55245
Files:
clang-tidy/abseil/AbseilTidyModule.cpp
clang-tidy/abseil/CMakeL
hwright added inline comments.
Comment at: clang-tidy/abseil/DurationRewriter.cpp:21
+struct DurationScale2IndexFunctor {
+ using argument_type = DurationScale;
+ unsigned operator()(DurationScale Scale) const {
JonasToth wrote:
> Are you using `argument_type`?
hwright added inline comments.
Comment at: test/clang-tidy/abseil-duration-subtraction.cpp:12
+ // CHECK-FIXES: absl::ToDoubleSeconds(d - absl::Seconds(1))
+ x = absl::ToDoubleSeconds(d) - absl::ToDoubleSeconds(d1);
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform subtract
hwright updated this revision to Diff 177749.
hwright marked 6 inline comments as done.
hwright added a comment.
Rebase
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D55245/new/
https://reviews.llvm.org/D55245
Files:
clang-tidy/abseil/AbseilTidyModule.cpp
clang-tidy/abseil/CMakeList
hwright updated this revision to Diff 188289.
hwright marked 5 inline comments as done.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D58137/new/
https://reviews.llvm.org/D58137
Files:
clang-tidy/abseil/AbseilTidyModule.cpp
clang-tidy/abseil/CMakeLists.txt
clang-tidy/abseil/Duration
hwright added inline comments.
Comment at: clang-tidy/abseil/TimeSubtractionCheck.cpp:97
+void TimeSubtractionCheck::check(const MatchFinder::MatchResult &Result) {
+ const auto *BinOp = Result.Nodes.getNodeAs("binop");
+ std::string inverse_name =
JonasToth wr
hwright updated this revision to Diff 188372.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D58137/new/
https://reviews.llvm.org/D58137
Files:
clang-tidy/abseil/AbseilTidyModule.cpp
clang-tidy/abseil/CMakeLists.txt
clang-tidy/abseil/DurationRewriter.cpp
clang-tidy/abseil/DurationR
hwright marked an inline comment as done.
hwright added inline comments.
Comment at: clang-tidy/abseil/TimeSubtractionCheck.cpp:97
+void TimeSubtractionCheck::check(const MatchFinder::MatchResult &Result) {
+ const auto *BinOp = Result.Nodes.getNodeAs("binop");
+ std::string in
This revision was automatically updated to reflect the committed changes.
Closed by commit rCTE355024: [clang-tidy] Add the abseil-time-subtraction check
(authored by hwright, committed by ).
Repository:
rCTE Clang Tools Extra
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D58137/new/
h
hwright created this revision.
hwright added reviewers: hokein, ioeric.
Herald added subscribers: cfe-commits, jdoerfert, xazax.hun, mgorny.
Herald added a project: clang.
This is an analog of the `abseil-duration-comparison` check, but for the
`absl::Time` domain. It has a similar implementatio
hwright added inline comments.
Comment at: clang-tidy/abseil/TimeComparisonCheck.cpp:23
+ auto Matcher =
+ binaryOperator(anyOf(hasOperatorName(">"), hasOperatorName(">="),
+ hasOperatorName("=="), hasOperatorName("<="),
ioeric wro
hwright updated this revision to Diff 189862.
hwright marked 6 inline comments as done.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D58977/new/
https://reviews.llvm.org/D58977
Files:
clang-tidy/abseil/AbseilTidyModule.cpp
clang-tidy/abseil/CMakeLists.txt
clang-tidy/abseil/TimeComp
hwright created this revision.
hwright added a reviewer: hokein.
Herald added subscribers: cfe-commits, xazax.hun.
Herald added a project: clang.
This adds coverage for expressions of these forms
absl::Duration d2, d1;
d2 = absl::Seconds(d1 / absl::Seconds(1));
d2 = absl::Seconds(absl::FDiv
hwright updated this revision to Diff 190075.
hwright marked an inline comment as done.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D58977/new/
https://reviews.llvm.org/D58977
Files:
clang-tidy/abseil/AbseilTidyModule.cpp
clang-tidy/abseil/CMakeLists.txt
clang-tidy/abseil/Duration
This revision was automatically updated to reflect the committed changes.
Closed by commit rCTE355835: [clang-tidy] Add the abseil-time-compare check
(authored by hwright, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D58977?vs=190075&id=190113#toc
Repository:
rCTE Clang
hwright updated this revision to Diff 190456.
hwright marked 4 inline comments as done.
hwright added a comment.
Addressed reviewer comments
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D59183/new/
https://reviews.llvm.org/D59183
Files:
clang-tidy/abseil/DurationUnnecessaryConversion
hwright added inline comments.
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-conversio
This revision was automatically updated to reflect the committed changes.
Closed by commit rCTE356141: [clang-tidy] Add additional patterns to the
abseil-duration-unnecessary… (authored by hwright, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D59183?vs=190456&id=190613#toc
hwright updated this revision to Diff 185057.
hwright marked 4 inline comments as done.
hwright retitled this revision from "[clang-tidy] Add the
abseil-duration-double-conversion check" to "[clang-tidy] Add the
abseil-duration-unnecessary-conversion check".
hwright added a comment.
Renamed to `
hwright added a comment.
@hokein Thanks for the suggestion on the name, I was looking for something a
little less confusing.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D57353/new/
https://reviews.llvm.org/D57353
___
cfe-commits mailing l
This revision was automatically updated to reflect the committed changes.
Closed by commit rCTE353079: [clang-tidy] Add the
abseil-duration-unnecessary-conversion check (authored by hwright, committed by
).
Herald added a project: clang.
Changed prior to commit:
https://reviews.llvm.org/D57353
hwright created this revision.
hwright added reviewers: ioeric, hokein, JonasToth, aaron.ballman.
hwright added a project: clang-tools-extra.
Herald added subscribers: cfe-commits, jdoerfert, xazax.hun, mgorny.
Herald added a project: clang.
Repository:
rCTE Clang Tools Extra
https://reviews.ll
hwright updated this revision to Diff 186569.
hwright marked 3 inline comments as done.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D58137/new/
https://reviews.llvm.org/D58137
Files:
clang-tidy/abseil/AbseilTidyModule.cpp
clang-tidy/abseil/CMakeLists.txt
clang-tidy/abseil/Duration
hwright updated this revision to Diff 187967.
hwright marked 15 inline comments as done.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D58137/new/
https://reviews.llvm.org/D58137
Files:
clang-tidy/abseil/AbseilTidyModule.cpp
clang-tidy/abseil/CMakeLists.txt
clang-tidy/abseil/Duratio
hwright added inline comments.
Comment at: clang-tidy/abseil/TimeSubtractionCheck.cpp:97
+void TimeSubtractionCheck::check(const MatchFinder::MatchResult &Result) {
+ const auto *BinOp = Result.Nodes.getNodeAs("binop");
+ std::string inverse_name =
JonasToth wr
hwright marked 2 inline comments as done.
hwright added inline comments.
Comment at: test/clang-tidy/abseil-duration-subtraction.cpp:12
+ // CHECK-FIXES: absl::ToDoubleSeconds(d - absl::Seconds(1))
+ x = absl::ToDoubleSeconds(d) - absl::ToDoubleSeconds(d1);
+ // CHECK-MESSAGES
hwright updated this revision to Diff 178039.
hwright marked an inline comment as done.
hwright added a comment.
Rebase and update documentation
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D55245/new/
https://reviews.llvm.org/D55245
Files:
clang-tidy/abseil/AbseilTidyModule.cpp
cl
hwright marked an inline comment as done.
hwright added a comment.
I've updated the documentation, and the rebased to `master`.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D55245/new/
https://reviews.llvm.org/D55245
___
cfe-commits mailing
hwright added a comment.
Thanks for reviewing, I'll go ahead and commit.
I've also removed the hash specialization, since we moved to `llvm::IndexedMap`
instead of `std::unordered_map` inside of `getInverseForScale`.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D55245/new/
https://rev
This revision was automatically updated to reflect the committed changes.
Closed by commit rL349073: [clang-tidy] Add the abseil-duration-subtraction
check (authored by hwright, committed by ).
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D55245?vs=
hwright updated this revision to Diff 178680.
hwright marked 4 inline comments as done.
hwright added a comment.
Update tests
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D55784/new/
https://reviews.llvm.org/D55784
Files:
clang-tidy/abseil/DurationComparisonCheck.cpp
clang-tidy/abs
hwright added inline comments.
Comment at: test/clang-tidy/abseil-duration-comparison.cpp:131
+ // We should still transform the expression inside this macro invocation
+#define VALUE_IF(v, e) v ? (e) : 0
+ int a = VALUE_IF(1, 5 > absl::ToDoubleSeconds(d1));
aa
1 - 100 of 120 matches
Mail list logo