[PATCH] D53339: Add the abseil-duration-factory-float clang-tidy check

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

[PATCH] D53339: [clang-tidy] Add the abseil-duration-factory-float check

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

[PATCH] D53339: [clang-tidy] Add the abseil-duration-factory-float check

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

[PATCH] D53339: [clang-tidy] Add the abseil-duration-factory-float check

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

[PATCH] D53339: [clang-tidy] Add the abseil-duration-factory-float check

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

[PATCH] D53339: [clang-tidy] Add the abseil-duration-factory-float check

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

[PATCH] D53339: [clang-tidy] Add the abseil-duration-factory-float check

2018-10-23 Thread Hyrum Wright via Phabricator via 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

[PATCH] D53339: [clang-tidy] Add the abseil-duration-factory-float check

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

[PATCH] D53339: [clang-tidy] Add the abseil-duration-factory-float check

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

[PATCH] D53339: [clang-tidy] Add the abseil-duration-factory-float check

2018-10-23 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:36 + +static bool InsideMacroDefinition(const MatchFinder::MatchResult &Result, + SourceRange Range) { ---

[PATCH] D53339: [clang-tidy] Add the abseil-duration-factory-float check

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

[PATCH] D53339: [clang-tidy] Add the abseil-duration-factory-float check

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

[PATCH] D53339: [clang-tidy] Add the abseil-duration-factory-float check

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

[PATCH] D53339: [clang-tidy] Add the abseil-duration-factory-float check

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

[PATCH] D53339: [clang-tidy] Add the abseil-duration-factory-float check

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

[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-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-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-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] 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] 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-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 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 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 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-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] 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] 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-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 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: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-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] D54246: [clang-tidy] Add the abseil-duration-factory-scale check

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

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

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

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

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

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

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

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

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

[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) { +

[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-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-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-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 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] 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] 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-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-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-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-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 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 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-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-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-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-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 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 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] 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-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-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 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 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 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-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-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 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 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-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-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] 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-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-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-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-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] 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] 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-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] 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-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] 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] 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] 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-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] 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-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
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] 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] 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-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-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] 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-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 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 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
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] 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] 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

  1   2   >