[PATCH] D75558: [clang-tidy] Update abseil-duration-unnecessary-conversion check to find more cases.

2020-03-13 Thread Hyrum Wright via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG3860b2a0bd09: [clang-tidy] Update Abseil Duration Conversion check to find more cases. (authored by hwright). Changed prior to commit: https://reviews.llvm.org/D75558?vs=247988&id=250252#toc Repository

[PATCH] D75558: [clang-tidy] Update abseil-duration-unnecessary-conversion check to find more cases.

2020-03-03 Thread Hyrum Wright via Phabricator via cfe-commits
hwright created this revision. hwright added reviewers: aaron.ballman, ymandel. Herald added subscribers: cfe-commits, xazax.hun. Herald added a project: clang. This check now handles cases where there's a scalar multiplication happening between the two conversions. Repository: rG LLVM Github

[PATCH] D59183: [clang-tidy] Expand cases covered by the abseil-duration-unnecessary-conversion check

2019-03-14 Thread Hyrum Wright via Phabricator via cfe-commits
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

[PATCH] D59183: [clang-tidy] Expand cases covered by the abseil-duration-unnecessary-conversion check

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

[PATCH] D59183: [clang-tidy] Expand cases covered by the abseil-duration-unnecessary-conversion check

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

[PATCH] D58977: [clang-tidy] Add the abseil-time-comparison check

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

[PATCH] D58977: [clang-tidy] Add the abseil-time-comparison check

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

[PATCH] D59183: [clang-tidy] Expand cases covered by the abseil-duration-unnecessary-conversion check

2019-03-09 Thread Hyrum Wright via Phabricator via cfe-commits
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

[PATCH] D58977: [clang-tidy] Add the abseil-time-comparison check

2019-03-08 Thread Hyrum Wright via Phabricator via cfe-commits
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

[PATCH] D58977: [clang-tidy] Add the abseil-time-comparison check

2019-03-08 Thread Hyrum Wright via Phabricator via cfe-commits
hwright added inline comments. Comment at: clang-tidy/abseil/TimeComparisonCheck.cpp:23 + auto Matcher = + binaryOperator(anyOf(hasOperatorName(">"), hasOperatorName(">="), + hasOperatorName("=="), hasOperatorName("<="), ioeric wro

[PATCH] D58977: [clang-tidy] Add the abseil-time-comparison check

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

[PATCH] D58137: [clang-tidy] Add the abseil-time-subtraction check

2019-02-27 Thread Hyrum Wright via Phabricator via cfe-commits
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

[PATCH] D58137: [clang-tidy] Add the abseil-time-subtraction check

2019-02-26 Thread Hyrum Wright via Phabricator via cfe-commits
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

[PATCH] D58137: [clang-tidy] Add the abseil-time-subtraction check

2019-02-26 Thread Hyrum Wright via Phabricator via cfe-commits
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

[PATCH] D58137: [clang-tidy] Add the abseil-time-subtraction check

2019-02-25 Thread Hyrum Wright via Phabricator via cfe-commits
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

[PATCH] D58137: [clang-tidy] Add the abseil-time-subtraction check

2019-02-25 Thread Hyrum Wright via Phabricator via cfe-commits
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

[PATCH] D58137: [clang-tidy] Add the abseil-time-subtraction check

2019-02-22 Thread Hyrum Wright via Phabricator via cfe-commits
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

[PATCH] D58137: [clang-tidy] Add the abseil-time-subtraction check

2019-02-22 Thread Hyrum Wright via Phabricator via cfe-commits
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

[PATCH] D58137: [clang-tidy] Add the abseil-time-subtraction check

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

[PATCH] D58137: [clang-tidy] Add the abseil-time-subtraction check

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

[PATCH] D57353: [clang-tidy] Add the abseil-duration-unnecessary-conversion check

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

[PATCH] D57353: [clang-tidy] Add the abseil-duration-unnecessary-conversion check

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

[PATCH] D57353: [clang-tidy] Add the abseil-duration-unnecessary-conversion check

2019-02-04 Thread Hyrum Wright via Phabricator via cfe-commits
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 `

[PATCH] D57353: [clang-tidy] Add the abseil-duration-double-conversion check

2019-01-30 Thread Hyrum Wright via Phabricator via cfe-commits
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

[PATCH] D57353: [clang-tidy] Add the abseil-duration-double-conversion check

2019-01-29 Thread Hyrum Wright via Phabricator via cfe-commits
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

[PATCH] D57353: [clang-tidy] Add the abseil-duration-double-conversion check

2019-01-29 Thread Hyrum Wright via Phabricator via cfe-commits
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

[PATCH] D57353: [clang-tidy] Add the abseil-duration-double-conversion check

2019-01-29 Thread Hyrum Wright via Phabricator via cfe-commits
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

[PATCH] D57353: [clang-tidy] Add the abseil-duration-double-conversion check

2019-01-29 Thread Hyrum Wright via Phabricator via cfe-commits
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

[PATCH] D57353: [clang-tidy] Add the abseil-duration-double-conversion check

2019-01-28 Thread Hyrum Wright via Phabricator via cfe-commits
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

[PATCH] D57185: [clang-tidy] Add the abseil-duration-addition check

2019-01-28 Thread Hyrum Wright via Phabricator via cfe-commits
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

[PATCH] D57185: [clang-tidy] Add the abseil-duration-addition check

2019-01-25 Thread Hyrum Wright via Phabricator via cfe-commits
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

[PATCH] D57185: [clang-tidy] Add the abseil-duration-addition check

2019-01-25 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-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

[PATCH] D57185: [clang-tidy] Add the abseil-duration-addition check

2019-01-25 Thread Hyrum Wright via Phabricator via cfe-commits
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

[PATCH] D57185: [clang-tidy] Add the abseil-duration-addition check

2019-01-25 Thread Hyrum Wright via Phabricator via cfe-commits
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

[PATCH] D57185: [clang-tidy] Add the abseil-duration-addition check

2019-01-25 Thread Hyrum Wright via Phabricator via cfe-commits
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

[PATCH] D57185: [clang-tidy] Add the abseil-duration-addition check

2019-01-24 Thread Hyrum Wright via Phabricator via cfe-commits
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

[PATCH] D56532: [clang-tidy] Add the abseil-duration-conversion-cast check

2019-01-17 Thread Hyrum Wright via Phabricator via cfe-commits
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=

[PATCH] D56532: [clang-tidy] Add the abseil-duration-conversion-cast check

2019-01-16 Thread Hyrum Wright via Phabricator via 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

[PATCH] D56532: [clang-tidy] Add the abseil-duration-conversion-cast check

2019-01-16 Thread Hyrum Wright via Phabricator via cfe-commits
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()) || +

[PATCH] D56532: [clang-tidy] Add the abseil-duration-conversion-cast check

2019-01-14 Thread Hyrum Wright via Phabricator via cfe-commits
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

[PATCH] D56532: [clang-tidy] Add the abseil-duration-conversion-cast check

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

[PATCH] D56532: [clang-tidy] Add the abseil-duration-conversion-cast check

2019-01-10 Thread Hyrum Wright via Phabricator via cfe-commits
hwright updated this revision to Diff 181125. hwright marked 5 inline comments as done. hwright added a comment. Update documentation line wrapping. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D56532/new/ https://reviews.llvm.org/D56532 Files: clang-tidy/abseil/AbseilTidyModule.cpp

[PATCH] D56532: [clang-tidy] Add the abseil-duration-conversion-cast check

2019-01-10 Thread Hyrum Wright via Phabricator via cfe-commits
hwright added inline comments. Comment at: docs/clang-tidy/checks/abseil-duration-conversion-cast.rst:20 + + + // Original - Cast from a double to an integer MyDeveloperDay wrote: > nit: double blank line This is intentional (and consistent with other examples i

[PATCH] D56532: [clang-tidy] Add the abseil-duration-conversion-cast check

2019-01-09 Thread Hyrum Wright via Phabricator via cfe-commits
hwright created this revision. hwright added reviewers: hokein, aaron.ballman. hwright added a project: clang-tools-extra. Herald added subscribers: cfe-commits, xazax.hun, mgorny. This suggests simplifying expressions which are casting conversion functions, such as `static_cast(absl::ToDoubleSec

[PATCH] D56090: Add a matcher for members of an initializer list expression

2019-01-07 Thread Hyrum Wright via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL350523: [clang] Add AST matcher for initializer list members (authored by hwright, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D56090?vs=18

[PATCH] D56090: Add a matcher for members of an initializer list expression

2019-01-04 Thread Hyrum Wright via Phabricator via cfe-commits
hwright marked 4 inline comments as done. hwright added inline comments. Comment at: include/clang/ASTMatchers/ASTMatchers.h:3527 + return N < Node.getNumInits() && + InnerMatcher.matches(*Node.getInit(N)->IgnoreParenImpCasts(), Finder, + B

[PATCH] D56090: Add a matcher for members of an initializer list expression

2019-01-04 Thread Hyrum Wright via Phabricator via cfe-commits
hwright updated this revision to Diff 180248. hwright added a comment. Removed `IgnoreParenImpCasts` call. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D56090/new/ https://reviews.llvm.org/D56090 Files: docs/LibASTMatchersReference.html include/clang/ASTMatchers/ASTMatchers.h lib

[PATCH] D56090: Add a matcher for members of an initializer list expression

2019-01-03 Thread Hyrum Wright via Phabricator via cfe-commits
hwright added inline comments. Comment at: include/clang/ASTMatchers/ASTMatchers.h:3527 + return N < Node.getNumInits() && + InnerMatcher.matches(*Node.getInit(N)->IgnoreParenImpCasts(), Finder, + Builder); aaron.ballman wr

[PATCH] D56090: Add a matcher for members of an initializer list expression

2019-01-03 Thread Hyrum Wright via Phabricator via cfe-commits
hwright updated this revision to Diff 180089. hwright marked an inline comment as done. hwright added a comment. Added tests, update docs. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D56090/new/ https://reviews.llvm.org/D56090 Files: docs/LibASTMatchersReference.html include/clang

[PATCH] D56090: Add a matcher for members of an initializer list expression

2018-12-26 Thread Hyrum Wright via Phabricator via cfe-commits
hwright added a comment. @lebedev.ri Where do the appropriate tests live? (I couldn't find an obvious subdirectory in `test/`) Where are the instructions for regenerating the documentation? Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D56090/new/ https://review

[PATCH] D56090: Add a matcher for members of an initializer list expression

2018-12-26 Thread Hyrum Wright via Phabricator via cfe-commits
hwright created this revision. hwright added a reviewer: aaron.ballman. hwright added a project: clang. Herald added a subscriber: cfe-commits. Much like `hasArg` for various call expressions, this allows `LibTooling` users to match against a member of an initializer list. This is currently bein

[PATCH] D56012: [clang-tidy] Be more liberal about literal zeroes in abseil checks

2018-12-21 Thread Hyrum Wright via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL349953: [clang-tidy] Be more liberal about literal zeroes in abseil checks (authored by hwright, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.or

[PATCH] D56012: [clang-tidy] Be more liberal about literal zeroes in abseil checks

2018-12-21 Thread Hyrum Wright via Phabricator via cfe-commits
hwright added a comment. btw, I think `hasInit` should probably be moved into the core set of matchers at some point. Comment at: clang-tidy/abseil/DurationRewriter.cpp:110 + ast_matchers::internal::Matcher, InnerMatcher) { + return (N < Node.getNumInits() && +

[PATCH] D56012: [clang-tidy] Be more liberal about literal zeroes in abseil checks

2018-12-21 Thread Hyrum Wright via Phabricator via cfe-commits
hwright updated this revision to Diff 179335. hwright marked 6 inline comments as done. hwright added a comment. Add documentation, adjust test. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D56012/new/ https://reviews.llvm.org/D56012 Files: clang-tidy/abseil/DurationFactoryScaleCheck

[PATCH] D56012: Be more liberal about literal zeroes in abseil checks

2018-12-21 Thread Hyrum Wright via Phabricator via cfe-commits
hwright created this revision. hwright added reviewers: aaron.ballman, JonasToth, alexfh, hokein. hwright added a project: clang-tools-extra. Herald added a subscriber: cfe-commits. Previously, we'd only match on literal floating or integral zeroes, but I've now also learned that some users spell

[PATCH] D55784: [clang-tidy] Update abseil-duration-comparison to handle macro arguments

2018-12-19 Thread Hyrum Wright via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. hwright marked an inline comment as done. Closed by commit rL349636: [clang-tidy] Diagnose abseil-duration-comparison on macro arguments (authored by hwright, committed by ). Herald added a subscriber: llvm-commits. Changed

[PATCH] D55784: [clang-tidy] Update abseil-duration-comparison to handle macro arguments

2018-12-19 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-comparison.cpp:146 +#define VALUE_IF_2(e) (e) +#define VALUE_IF(v, e, type) (v ? VALUE_IF_2(absl::To##type##Seconds(e)) : 0) + int a3 = VALUE_IF(1, d1, Double); -

[PATCH] D55784: [clang-tidy] Update abseil-duration-comparison to handle macro arguments

2018-12-18 Thread Hyrum Wright via Phabricator via cfe-commits
hwright added a comment. @aaron.ballman I am both grateful and sad that I don't possess the same macro creativity as you do. :) (I'm also sad that the various clang APIs aren't as well documented as I hoped. The current solution works well, but it took a while and a bit of consultation with s

[PATCH] D55784: [clang-tidy] Update abseil-duration-comparison to handle macro arguments

2018-12-18 Thread Hyrum Wright via Phabricator via cfe-commits
hwright updated this revision to Diff 178733. hwright marked 3 inline comments as done. hwright added a comment. Another test. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D55784/new/ https://reviews.llvm.org/D55784 Files: clang-tidy/abseil/DurationComparisonCheck.cpp clang-tidy/ab

[PATCH] D55784: [clang-tidy] Update abseil-duration-comparison to handle macro arguments

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

[PATCH] D55784: [clang-tidy] Update abseil-duration-comparison to handle macro arguments

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

[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 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-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-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 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 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 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 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-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] D54737: [clang-tidy] Add the abseil-duration-comparison check

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

[PATCH] D54737: [clang-tidy] Add the abseil-duration-comparison check

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

[PATCH] D54737: [clang-tidy] Add the abseil-duration-comparison check

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

[PATCH] D54737: [clang-tidy] Add the abseil-duration-comparison check

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

[PATCH] D54737: [clang-tidy] Add the abseil-duration-comparison check

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

[PATCH] D54737: [clang-tidy] Add the abseil-duration-comparison check

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

[PATCH] D54737: [clang-tidy] Add the abseil-duration-comparison check

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

[PATCH] D54737: [clang-tidy] Add the abseil-duration-comparison check

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

[PATCH] D54737: [clang-tidy] Add the abseil-duration-comparison check

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

[PATCH] D54737: [clang-tidy] Add the abseil-duration-comparison check

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

[PATCH] D54737: [clang-tidy] Add the abseil-duration-comparison check

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

[PATCH] D54737: [clang-tidy] Add the abseil-duration-comparison check

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

[PATCH] D54737: [clang-tidy] Add the abseil-duration-comparison check

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

[PATCH] D54737: [clang-tidy] Add the abseil-duration-comparison check

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

[PATCH] D54737: [clang-tidy] Add the abseil-duration-comparison check

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

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

2018-11-16 Thread Hyrum Wright via Phabricator via 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

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

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

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

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

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

2018-11-14 Thread Hyrum Wright via Phabricator via cfe-commits
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) { +

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

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

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

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

  1   2   >