This is an analog of the abseil-duration-comparison check, but for the absl::Time domain. It has a similar implementation and tests.
Details
Diff Detail
- Repository
 - rCTE Clang Tools Extra
 
Event Timeline
| clang-tidy/abseil/TimeComparisonCheck.cpp | ||
|---|---|---|
| 24 | DurationComparisonCheck.cpp has a very similar matcher pattern. Maybe pull out a common matcher for this? E.g. comparisonOperatorWithCallee(...)?  | |
| 43 | Move this comment closer the replacement logic below?  | |
| 47 | nit: double negation is a bit hard to read. maybe !(isNotInMacro(LSH) && isNotInMacro(RHS))? Ideally, the helper should be isInMacro instead of isNotInMacro.  | |
| clang-tidy/abseil/TimeComparisonCheck.cpp | ||
|---|---|---|
| 24 | My one concern about doing so is that it would move the name bindings into a separate location away from the callback consuming those bindings. Since this is only the second instance of this pattern, would it be reasonable to wait until there's a third to combine them?  | |
| clang-tidy/abseil/TimeComparisonCheck.cpp | ||
|---|---|---|
| 24 | 
 I think the name binding can stay in the same file. comparisonOperatorWithCallee is a matcher for a FunctionDecl, so, on the call site, you could do comparisonOperatorWithCallee(functionDecl(TimeConversionFunction()).bind("function_decl")).bind("binop").  | |
DurationComparisonCheck.cpp has a very similar matcher pattern.
Maybe pull out a common matcher for this? E.g. comparisonOperatorWithCallee(...)?