diff options
Diffstat (limited to 'clang-tools-extra/test/clang-tidy/checkers/abseil/time-comparison.cpp')
-rw-r--r-- | clang-tools-extra/test/clang-tidy/checkers/abseil/time-comparison.cpp | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/clang-tools-extra/test/clang-tidy/checkers/abseil/time-comparison.cpp b/clang-tools-extra/test/clang-tidy/checkers/abseil/time-comparison.cpp index 4de43ec..ad3ce4c 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/abseil/time-comparison.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/abseil/time-comparison.cpp @@ -1,4 +1,4 @@ -// RUN: %check_clang_tidy --match-partial-fixes %s abseil-time-comparison %t -- -- -I%S/Inputs +// RUN: %check_clang_tidy %s abseil-time-comparison %t -- -- -I%S/Inputs #include "absl/time/time.h" @@ -11,67 +11,67 @@ void f() { // Check against the RHS b = x > absl::ToUnixSeconds(t1); // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison] - // CHECK-FIXES: absl::FromUnixSeconds(x) > t1; + // CHECK-FIXES: b = absl::FromUnixSeconds(x) > t1; b = x >= absl::ToUnixSeconds(t1); // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison] - // CHECK-FIXES: absl::FromUnixSeconds(x) >= t1; + // CHECK-FIXES: b = absl::FromUnixSeconds(x) >= t1; b = x == absl::ToUnixSeconds(t1); // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison] - // CHECK-FIXES: absl::FromUnixSeconds(x) == t1; + // CHECK-FIXES: b = absl::FromUnixSeconds(x) == t1; b = x <= absl::ToUnixSeconds(t1); // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison] - // CHECK-FIXES: absl::FromUnixSeconds(x) <= t1; + // CHECK-FIXES: b = absl::FromUnixSeconds(x) <= t1; b = x < absl::ToUnixSeconds(t1); // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison] - // CHECK-FIXES: absl::FromUnixSeconds(x) < t1; + // CHECK-FIXES: b = absl::FromUnixSeconds(x) < t1; b = x == absl::ToUnixSeconds(t1 - d2); // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison] - // CHECK-FIXES: absl::FromUnixSeconds(x) == t1 - d2; + // CHECK-FIXES: b = absl::FromUnixSeconds(x) == t1 - d2; b = absl::ToUnixSeconds(t1) > absl::ToUnixSeconds(t2); // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison] - // CHECK-FIXES: t1 > t2; + // CHECK-FIXES: b = t1 > t2; // Check against the LHS b = absl::ToUnixSeconds(t1) < x; // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison] - // CHECK-FIXES: t1 < absl::FromUnixSeconds(x); + // CHECK-FIXES: b = t1 < absl::FromUnixSeconds(x); b = absl::ToUnixSeconds(t1) <= x; // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison] - // CHECK-FIXES: t1 <= absl::FromUnixSeconds(x); + // CHECK-FIXES: b = t1 <= absl::FromUnixSeconds(x); b = absl::ToUnixSeconds(t1) == x; // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison] - // CHECK-FIXES: t1 == absl::FromUnixSeconds(x); + // CHECK-FIXES: b = t1 == absl::FromUnixSeconds(x); b = absl::ToUnixSeconds(t1) >= x; // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison] - // CHECK-FIXES: t1 >= absl::FromUnixSeconds(x); + // CHECK-FIXES: b = t1 >= absl::FromUnixSeconds(x); b = absl::ToUnixSeconds(t1) > x; // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison] - // CHECK-FIXES: t1 > absl::FromUnixSeconds(x); + // CHECK-FIXES: b = t1 > absl::FromUnixSeconds(x); // Comparison against zero b = absl::ToUnixSeconds(t1) < 0.0; // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison] - // CHECK-FIXES: t1 < absl::UnixEpoch(); + // CHECK-FIXES: b = t1 < absl::UnixEpoch(); b = absl::ToUnixSeconds(t1) < 0; // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison] - // CHECK-FIXES: t1 < absl::UnixEpoch(); + // CHECK-FIXES: b = t1 < absl::UnixEpoch(); // Scales other than Seconds b = x > absl::ToUnixMicros(t1); // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison] - // CHECK-FIXES: absl::FromUnixMicros(x) > t1; + // CHECK-FIXES: b = absl::FromUnixMicros(x) > t1; b = x >= absl::ToUnixMillis(t1); // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison] - // CHECK-FIXES: absl::FromUnixMillis(x) >= t1; + // CHECK-FIXES: b = absl::FromUnixMillis(x) >= t1; b = x == absl::ToUnixNanos(t1); // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison] - // CHECK-FIXES: absl::FromUnixNanos(x) == t1; + // CHECK-FIXES: b = absl::FromUnixNanos(x) == t1; b = x <= absl::ToUnixMinutes(t1); // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison] - // CHECK-FIXES: absl::FromUnixMinutes(x) <= t1; + // CHECK-FIXES: b = absl::FromUnixMinutes(x) <= t1; b = x < absl::ToUnixHours(t1); // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison] - // CHECK-FIXES: absl::FromUnixHours(x) < t1; + // CHECK-FIXES: b = absl::FromUnixHours(x) < t1; // A long expression bool some_condition; @@ -88,20 +88,20 @@ void f() { int y; b = (y + 5) * 10 > absl::ToUnixMillis(t1); // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison] - // CHECK-FIXES: absl::FromUnixMillis((y + 5) * 10) > t1; + // CHECK-FIXES: b = absl::FromUnixMillis((y + 5) * 10) > t1; // 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::ToUnixSeconds(t1)); // CHECK-MESSAGES: [[@LINE-1]]:23: warning: perform comparison in the time domain [abseil-time-comparison] - // CHECK-FIXES: VALUE_IF(1, absl::FromUnixSeconds(5) > t1); + // CHECK-FIXES: int a = VALUE_IF(1, absl::FromUnixSeconds(5) > t1); #undef VALUE_IF #define VALUE_IF_2(e) (e) #define VALUE_IF(v, e) v ? VALUE_IF_2(e) : VALUE_IF_2(0) int a2 = VALUE_IF(1, 5 > absl::ToUnixSeconds(t1)); // CHECK-MESSAGES: [[@LINE-1]]:24: warning: perform comparison in the time domain [abseil-time-comparison] - // CHECK-FIXES: VALUE_IF(1, absl::FromUnixSeconds(5) > t1); + // CHECK-FIXES: int a2 = VALUE_IF(1, absl::FromUnixSeconds(5) > t1); #undef VALUE_IF #undef VALUE_IF_2 |