apply the latest clang-format Change-Id: I885b76bf8ed0f0ba81c14a30e603fca70f07f6a8 Reviewed-on: https://gn-review.googlesource.com/c/gn/+/18600 Commit-Queue: Takuto Ikuta <tikuta@google.com> Reviewed-by: David Turner <digit@google.com> Commit-Queue: David Turner <digit@google.com>
diff --git a/src/base/numerics/checked_math.h b/src/base/numerics/checked_math.h index 433860c..50f0d23 100644 --- a/src/base/numerics/checked_math.h +++ b/src/base/numerics/checked_math.h
@@ -66,8 +66,7 @@ #elif defined(_MSC_VER) _Check_return_ #endif - constexpr bool - AssignIfValid(Dst* result) const { + constexpr bool AssignIfValid(Dst* result) const { return BASE_NUMERICS_LIKELY(IsValid<Dst>()) ? ((*result = static_cast<Dst>(state_.value())), true) : false;
diff --git a/src/base/numerics/checked_math_impl.h b/src/base/numerics/checked_math_impl.h index 673f6d6..4554a76 100644 --- a/src/base/numerics/checked_math_impl.h +++ b/src/base/numerics/checked_math_impl.h
@@ -417,20 +417,20 @@ // This is just boilerplate that wraps the standard floating point arithmetic. // A macro isn't the nicest solution, but it beats rewriting these repeatedly. -#define BASE_FLOAT_ARITHMETIC_OPS(NAME, OP) \ - template <typename T, typename U> \ - struct Checked##NAME##Op< \ - T, U, \ - typename std::enable_if<std::is_floating_point<T>::value || \ - std::is_floating_point<U>::value>::type> { \ - using result_type = typename MaxExponentPromotion<T, U>::type; \ - template <typename V> \ - static constexpr bool Do(T x, U y, V* result) { \ - using Promotion = typename MaxExponentPromotion<T, U>::type; \ - Promotion presult = x OP y; \ - *result = static_cast<V>(presult); \ - return IsValueInRangeForNumericType<V>(presult); \ - } \ +#define BASE_FLOAT_ARITHMETIC_OPS(NAME, OP) \ + template <typename T, typename U> \ + struct Checked##NAME## \ + Op<T, U, \ + typename std::enable_if<std::is_floating_point<T>::value || \ + std::is_floating_point<U>::value>::type> { \ + using result_type = typename MaxExponentPromotion<T, U>::type; \ + template <typename V> \ + static constexpr bool Do(T x, U y, V* result) { \ + using Promotion = typename MaxExponentPromotion<T, U>::type; \ + Promotion presult = x OP y; \ + *result = static_cast<V>(presult); \ + return IsValueInRangeForNumericType<V>(presult); \ + } \ }; BASE_FLOAT_ARITHMETIC_OPS(Add, +)
diff --git a/src/base/numerics/clamped_math_impl.h b/src/base/numerics/clamped_math_impl.h index 303a7e9..814d6c3 100644 --- a/src/base/numerics/clamped_math_impl.h +++ b/src/base/numerics/clamped_math_impl.h
@@ -315,17 +315,17 @@ // This is just boilerplate that wraps the standard floating point arithmetic. // A macro isn't the nicest solution, but it beats rewriting these repeatedly. -#define BASE_FLOAT_ARITHMETIC_OPS(NAME, OP) \ - template <typename T, typename U> \ - struct Clamped##NAME##Op< \ - T, U, \ - typename std::enable_if<std::is_floating_point<T>::value || \ - std::is_floating_point<U>::value>::type> { \ - using result_type = typename MaxExponentPromotion<T, U>::type; \ - template <typename V = result_type> \ - static constexpr V Do(T x, U y) { \ - return saturated_cast<V>(x OP y); \ - } \ +#define BASE_FLOAT_ARITHMETIC_OPS(NAME, OP) \ + template <typename T, typename U> \ + struct Clamped##NAME## \ + Op<T, U, \ + typename std::enable_if<std::is_floating_point<T>::value || \ + std::is_floating_point<U>::value>::type> { \ + using result_type = typename MaxExponentPromotion<T, U>::type; \ + template <typename V = result_type> \ + static constexpr V Do(T x, U y) { \ + return saturated_cast<V>(x OP y); \ + } \ }; BASE_FLOAT_ARITHMETIC_OPS(Add, +)
diff --git a/src/gn/tokenizer_unittest.cc b/src/gn/tokenizer_unittest.cc index a2aad0f..dfec895 100644 --- a/src/gn/tokenizer_unittest.cc +++ b/src/gn/tokenizer_unittest.cc
@@ -101,16 +101,14 @@ } TEST(Tokenizer, DoubleMinus) { - TokenExpectation tokens[] = {{Token::INTEGER, "1"}, - {Token::MINUS, "-"}, - {Token::INTEGER, "-1"}}; + TokenExpectation tokens[] = { + {Token::INTEGER, "1"}, {Token::MINUS, "-"}, {Token::INTEGER, "-1"}}; EXPECT_TRUE(CheckTokenizer(" 1 - -1 ", tokens)); } TEST(Tokenizer, DoubleMinusNoSpace) { - TokenExpectation tokens[] = {{Token::INTEGER, "1"}, - {Token::MINUS, "-"}, - {Token::INTEGER, "-1"}}; + TokenExpectation tokens[] = { + {Token::INTEGER, "1"}, {Token::MINUS, "-"}, {Token::INTEGER, "-1"}}; EXPECT_TRUE(CheckTokenizer(" 1--1 ", tokens)); }