Fix formatting of C++ files

PiperOrigin-RevId: 504325204
Change-Id: Iaa1d6d0ab1dccaaeef26f9cb109d530835499240
This commit is contained in:
Tom Hughes 2023-01-24 11:09:35 -08:00 committed by Copybara-Service
parent 408471e20c
commit 2491710524
15 changed files with 84 additions and 85 deletions

View File

@ -1420,14 +1420,14 @@ struct WithArgsAction {
// providing a call operator because even with a particular set of arguments // providing a call operator because even with a particular set of arguments
// they don't have a fixed return type. // they don't have a fixed return type.
template <typename R, typename... Args, template <
typename R, typename... Args,
typename std::enable_if< typename std::enable_if<
std::is_convertible< std::is_convertible<InnerAction,
InnerAction, // Unfortunately we can't use the InnerSignature
// Unfortunately we can't use the InnerSignature alias here; // alias here; MSVC complains about the I
// MSVC complains about the I parameter pack not being // parameter pack not being expanded (error C3520)
// expanded (error C3520) despite it being expanded in the // despite it being expanded in the type alias.
// type alias.
// TupleElement is also an MSVC workaround. // TupleElement is also an MSVC workaround.
// See its definition for details. // See its definition for details.
OnceAction<R(internal::TupleElement< OnceAction<R(internal::TupleElement<
@ -1447,14 +1447,14 @@ struct WithArgsAction {
return OA{std::move(inner_action)}; return OA{std::move(inner_action)};
} }
template <typename R, typename... Args, template <
typename R, typename... Args,
typename std::enable_if< typename std::enable_if<
std::is_convertible< std::is_convertible<const InnerAction&,
const InnerAction&, // Unfortunately we can't use the InnerSignature
// Unfortunately we can't use the InnerSignature alias here; // alias here; MSVC complains about the I
// MSVC complains about the I parameter pack not being // parameter pack not being expanded (error C3520)
// expanded (error C3520) despite it being expanded in the // despite it being expanded in the type alias.
// type alias.
// TupleElement is also an MSVC workaround. // TupleElement is also an MSVC workaround.
// See its definition for details. // See its definition for details.
Action<R(internal::TupleElement< Action<R(internal::TupleElement<

View File

@ -180,8 +180,9 @@ using internal::FunctionMocker;
_Signature)>::Result \ _Signature)>::Result \
GMOCK_INTERNAL_EXPAND(_CallType) \ GMOCK_INTERNAL_EXPAND(_CallType) \
_MethodName(GMOCK_PP_REPEAT(GMOCK_INTERNAL_PARAMETER, _Signature, _N)) \ _MethodName(GMOCK_PP_REPEAT(GMOCK_INTERNAL_PARAMETER, _Signature, _N)) \
GMOCK_PP_IF(_Constness, const, ) _RefSpec _NoexceptSpec \ GMOCK_PP_IF(_Constness, const, ) \
GMOCK_PP_IF(_Override, override, ) GMOCK_PP_IF(_Final, final, ) { \ _RefSpec _NoexceptSpec GMOCK_PP_IF(_Override, override, ) \
GMOCK_PP_IF(_Final, final, ) { \
GMOCK_MOCKER_(_N, _Constness, _MethodName) \ GMOCK_MOCKER_(_N, _Constness, _MethodName) \
.SetOwnerAndName(this, #_MethodName); \ .SetOwnerAndName(this, #_MethodName); \
return GMOCK_MOCKER_(_N, _Constness, _MethodName) \ return GMOCK_MOCKER_(_N, _Constness, _MethodName) \

View File

@ -5474,8 +5474,7 @@ PolymorphicMatcher<internal::ExceptionMatcherImpl<Err>> ThrowsMessage(
inline name##Matcher GMOCK_INTERNAL_WARNING_PUSH() \ inline name##Matcher GMOCK_INTERNAL_WARNING_PUSH() \
GMOCK_INTERNAL_WARNING_CLANG(ignored, "-Wunused-function") \ GMOCK_INTERNAL_WARNING_CLANG(ignored, "-Wunused-function") \
GMOCK_INTERNAL_WARNING_CLANG(ignored, "-Wunused-member-function") \ GMOCK_INTERNAL_WARNING_CLANG(ignored, "-Wunused-member-function") \
name \ name GMOCK_INTERNAL_WARNING_POP()() { \
GMOCK_INTERNAL_WARNING_POP()() { \
return {}; \ return {}; \
} \ } \
template <typename arg_type> \ template <typename arg_type> \

View File

@ -526,9 +526,10 @@
GMOCK_INTERNAL_LIST_##value_params)){}) \ GMOCK_INTERNAL_LIST_##value_params)){}) \
GMOCK_ACTION_CLASS_(name, value_params)(const GMOCK_ACTION_CLASS_( \ GMOCK_ACTION_CLASS_(name, value_params)(const GMOCK_ACTION_CLASS_( \
name, value_params) &) noexcept GMOCK_INTERNAL_DEFN_COPY_ \ name, value_params) &) noexcept GMOCK_INTERNAL_DEFN_COPY_ \
##value_params GMOCK_ACTION_CLASS_(name, value_params)( \ ##value_params \
GMOCK_ACTION_CLASS_(name, value_params) &&) noexcept \ GMOCK_ACTION_CLASS_(name, value_params)(GMOCK_ACTION_CLASS_( \
GMOCK_INTERNAL_DEFN_COPY_##value_params template <typename F> \ name, value_params) &&) noexcept GMOCK_INTERNAL_DEFN_COPY_ \
##value_params template <typename F> \
operator ::testing::Action<F>() const { \ operator ::testing::Action<F>() const { \
return GMOCK_PP_IF( \ return GMOCK_PP_IF( \
GMOCK_PP_IS_EMPTY(GMOCK_INTERNAL_COUNT_##value_params), \ GMOCK_PP_IS_EMPTY(GMOCK_INTERNAL_COUNT_##value_params), \

View File

@ -449,7 +449,8 @@ internal::ParamConverterGenerator<T> ConvertGenerator(
#define TEST_P(test_suite_name, test_name) \ #define TEST_P(test_suite_name, test_name) \
class GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \ class GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \
: public test_suite_name, private ::testing::internal::GTestNonCopyable {\ : public test_suite_name, \
private ::testing::internal::GTestNonCopyable { \
public: \ public: \
GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)() {} \ GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)() {} \
void TestBody() override; \ void TestBody() override; \

View File

@ -152,16 +152,15 @@ size_t FilePath::CalculateRootLength() const {
auto s = path.begin(); auto s = path.begin();
auto end = path.end(); auto end = path.end();
#if GTEST_OS_WINDOWS #if GTEST_OS_WINDOWS
if (end - s >= 2 && s[1] == ':' && if (end - s >= 2 && s[1] == ':' && (end - s == 2 || IsPathSeparator(s[2])) &&
(end - s == 2 || IsPathSeparator(s[2])) &&
(('A' <= s[0] && s[0] <= 'Z') || ('a' <= s[0] && s[0] <= 'z'))) { (('A' <= s[0] && s[0] <= 'Z') || ('a' <= s[0] && s[0] <= 'z'))) {
// A typical absolute path like "C:\Windows" or "D:" // A typical absolute path like "C:\Windows" or "D:"
s += 2; s += 2;
if (s != end) { if (s != end) {
++s; ++s;
} }
} else if (end - s >= 3 && IsPathSeparator(*s) && IsPathSeparator(*(s + 1)) } else if (end - s >= 3 && IsPathSeparator(*s) && IsPathSeparator(*(s + 1)) &&
&& !IsPathSeparator(*(s + 2))) { !IsPathSeparator(*(s + 2))) {
// Move past the "\\" prefix in a UNC path like "\\Server\Share\Folder" // Move past the "\\" prefix in a UNC path like "\\Server\Share\Folder"
s += 2; s += 2;
// Skip 2 components and their following separators ("Server\" and "Share\") // Skip 2 components and their following separators ("Server\" and "Share\")
@ -295,9 +294,7 @@ bool FilePath::IsRootDirectory() const {
} }
// Returns true if pathname describes an absolute path. // Returns true if pathname describes an absolute path.
bool FilePath::IsAbsolutePath() const { bool FilePath::IsAbsolutePath() const { return CalculateRootLength() > 0; }
return CalculateRootLength() > 0;
}
// Returns a pathname for a file that does not currently exist. The pathname // Returns a pathname for a file that does not currently exist. The pathname
// will be directory/base_name.extension or // will be directory/base_name.extension or

View File

@ -1134,8 +1134,8 @@ class Timer {
// Return time elapsed in milliseconds since the timer was created. // Return time elapsed in milliseconds since the timer was created.
TimeInMillis Elapsed() { TimeInMillis Elapsed() {
return std::chrono::duration_cast<std::chrono::milliseconds>( return std::chrono::duration_cast<std::chrono::milliseconds>(clock::now() -
clock::now() - start_) start_)
.count(); .count();
} }