[PATCH] D55245: [clang-tidy] Add the abseil-duration-subtraction check

2018-12-13 Thread Hyrum Wright via Phabricator via cfe-commits
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=

[PATCH] D55245: [clang-tidy] Add the abseil-duration-subtraction check

2018-12-13 Thread Hyrum Wright via Phabricator via cfe-commits
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

[PATCH] D55245: [clang-tidy] Add the abseil-duration-subtraction check

2018-12-13 Thread Jonas Toth via Phabricator via cfe-commits
JonasToth accepted this revision. JonasToth added a comment. LGTM with the doc-nit. Comment at: docs/clang-tidy/checks/abseil-duration-subtraction.rst:33 +Note: As with other ``clang-tidy`` checks, it is possible that multiple fixes +may overlap (as in the case of nested expres

[PATCH] D55245: [clang-tidy] Add the abseil-duration-subtraction check

2018-12-13 Thread Hyrum Wright via Phabricator via cfe-commits
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

[PATCH] D55245: [clang-tidy] Add the abseil-duration-subtraction check

2018-12-13 Thread Hyrum Wright via Phabricator via cfe-commits
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

[PATCH] D55245: [clang-tidy] Add the abseil-duration-subtraction check

2018-12-13 Thread Jonas Toth via Phabricator via cfe-commits
JonasToth added a comment. Did you rebase the check onto the new master with your refactorings in? Comment at: test/clang-tidy/abseil-duration-subtraction.cpp:12 + // CHECK-FIXES: absl::ToDoubleSeconds(d - absl::Seconds(1)) + x = absl::ToDoubleSeconds(d) - absl::ToDoubleSecon

[PATCH] D55245: [clang-tidy] Add the abseil-duration-subtraction check

2018-12-12 Thread Hyrum Wright via Phabricator via cfe-commits
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

[PATCH] D55245: [clang-tidy] Add the abseil-duration-subtraction check

2018-12-12 Thread Jonas Toth via Phabricator via cfe-commits
JonasToth 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 subtra

[PATCH] D55245: [clang-tidy] Add the abseil-duration-subtraction check

2018-12-11 Thread Hyrum Wright via Phabricator via cfe-commits
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

[PATCH] D55245: [clang-tidy] Add the abseil-duration-subtraction check

2018-12-11 Thread Hyrum Wright via Phabricator via cfe-commits
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

[PATCH] D55245: [clang-tidy] Add the abseil-duration-subtraction check

2018-12-10 Thread Jonas Toth via Phabricator via cfe-commits
JonasToth added inline comments. Comment at: clang-tidy/abseil/DurationRewriter.cpp:77 + getInverseForScale(Scale); + if (const auto *MaybeCallArg = selectFirst( + "e", hwright wrote: > JonasToth wrote: > > In Principle the `Node` could have multip

[PATCH] D55245: [clang-tidy] Add the abseil-duration-subtraction check

2018-12-10 Thread Hyrum Wright via Phabricator via cfe-commits
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

[PATCH] D55245: [clang-tidy] Add the abseil-duration-subtraction check

2018-12-10 Thread Hyrum Wright via Phabricator via cfe-commits
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`?

[PATCH] D55245: [clang-tidy] Add the abseil-duration-subtraction check

2018-12-10 Thread Jonas Toth via Phabricator via cfe-commits
JonasToth added inline comments. Comment at: clang-tidy/abseil/DurationRewriter.cpp:21 +struct DurationScale2IndexFunctor { + using argument_type = DurationScale; + unsigned operator()(DurationScale Scale) const { Are you using `argument_type`? Browser searchin

[PATCH] D55245: [clang-tidy] Add the abseil-duration-subtraction check

2018-12-10 Thread Hyrum Wright via Phabricator via cfe-commits
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

[PATCH] D55245: [clang-tidy] Add the abseil-duration-subtraction check

2018-12-10 Thread Hyrum Wright via Phabricator via cfe-commits
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

[PATCH] D55245: [clang-tidy] Add the abseil-duration-subtraction check

2018-12-10 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri 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: +

[PATCH] D55245: [clang-tidy] Add the abseil-duration-subtraction check

2018-12-10 Thread Hyrum Wright via Phabricator via cfe-commits
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

[PATCH] D55245: [clang-tidy] Add the abseil-duration-subtraction check

2018-12-07 Thread Hyrum Wright via Phabricator via cfe-commits
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

[PATCH] D55245: [clang-tidy] Add the abseil-duration-subtraction check

2018-12-07 Thread Hyrum Wright via Phabricator via cfe-commits
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

[PATCH] D55245: [clang-tidy] Add the abseil-duration-subtraction check

2018-12-07 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added inline comments. Comment at: clang-tidy/abseil/DurationRewriter.cpp:35 +getInverseForScale(DurationScale Scale) { + static const std::unordered_map> hwright wrote: > lebedev.ri wrote: > > https://llvm.org/docs/ProgrammersManual.html#other-map-li

[PATCH] D55245: [clang-tidy] Add the abseil-duration-subtraction check

2018-12-07 Thread Hyrum Wright via Phabricator via cfe-commits
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 >

[PATCH] D55245: [clang-tidy] Add the abseil-duration-subtraction check

2018-12-07 Thread Hyrum Wright via Phabricator via cfe-commits
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

[PATCH] D55245: [clang-tidy] Add the abseil-duration-subtraction check

2018-12-07 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment. Please always upload all patches with the full context (`-U9`) Comment at: clang-tidy/abseil/DurationRewriter.cpp:35 +getInverseForScale(DurationScale Scale) { + static const std::unordered_map> https://llvm.org/docs/Programmers

[PATCH] D55245: [clang-tidy] Add the abseil-duration-subtraction check

2018-12-07 Thread Haojian Wu via Phabricator via cfe-commits
hokein accepted this revision. hokein added subscribers: astrelni, ahedberg. hokein added a comment. This revision is now accepted and ready to land. The check looks good from my side, except one nit. > I assume I've got the right reviewers here, but I've also been sending a > bunch of stuff you

[PATCH] D55245: [clang-tidy] Add the abseil-duration-subtraction check

2018-12-05 Thread Jonas Toth via Phabricator via cfe-commits
JonasToth added a comment. In D55245#1320546 , @hwright wrote: > 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. Hi hyrum

[PATCH] D55245: [clang-tidy] Add the abseil-duration-subtraction check

2018-12-05 Thread Hyrum Wright via Phabricator via cfe-commits
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

[PATCH] D55245: [clang-tidy] Add the abseil-duration-subtraction check

2018-12-04 Thread Hyrum Wright via Phabricator via cfe-commits
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

[PATCH] D55245: [clang-tidy] Add the abseil-duration-subtraction check

2018-12-04 Thread Eugene Zelenko via Phabricator via cfe-commits
Eugene.Zelenko added inline comments. Comment at: docs/clang-tidy/checks/abseil-duration-subtraction.rst:7 +Checks for cases where subtraction should be performed in the +``absl::Duration`` domain. When subtracting two values, and the first one is +known to be a conversion from