diff --git a/llvm/utils/unittest/googlemock/include/gmock/gmock-matchers.h b/llvm/utils/unittest/googlemock/include/gmock/gmock-matchers.h --- a/llvm/utils/unittest/googlemock/include/gmock/gmock-matchers.h +++ b/llvm/utils/unittest/googlemock/include/gmock/gmock-matchers.h @@ -59,9 +59,11 @@ #endif #ifdef __clang__ +#if __has_warning("-Wdeprecated-copy") #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-copy" #endif +#endif namespace testing { @@ -4422,8 +4424,10 @@ } // namespace testing #ifdef __clang__ +#if __has_warning("-Wdeprecated-copy") #pragma clang diagnostic pop #endif +#endif // Include any custom callback matchers added by the local installation. // We must include this header at the end to make sure it can use the diff --git a/llvm/utils/unittest/googlemock/include/gmock/gmock.h b/llvm/utils/unittest/googlemock/include/gmock/gmock.h --- a/llvm/utils/unittest/googlemock/include/gmock/gmock.h +++ b/llvm/utils/unittest/googlemock/include/gmock/gmock.h @@ -56,9 +56,11 @@ // where all clauses are optional and WillOnce() can be repeated. #ifdef __clang__ +#if __has_warning("-Wdeprecated-copy") #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-copy" #endif +#endif #include "gmock/gmock-actions.h" #include "gmock/gmock-cardinalities.h" @@ -97,6 +99,8 @@ } // namespace testing #ifdef __clang__ +#if __has_warning("-Wdeprecated-copy") #pragma clang diagnostic pop #endif +#endif #endif // GMOCK_INCLUDE_GMOCK_GMOCK_H_ diff --git a/llvm/utils/unittest/googletest/include/gtest/internal/gtest-param-util-generated.h b/llvm/utils/unittest/googletest/include/gtest/internal/gtest-param-util-generated.h --- a/llvm/utils/unittest/googletest/include/gtest/internal/gtest-param-util-generated.h +++ b/llvm/utils/unittest/googletest/include/gtest/internal/gtest-param-util-generated.h @@ -55,9 +55,11 @@ #if GTEST_HAS_PARAM_TEST #ifdef __clang__ +#if __has_warning("-Wdeprecated-copy") #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-copy" #endif +#endif namespace testing { @@ -5147,8 +5149,10 @@ } // namespace testing #ifdef __clang__ +#if __has_warning("-Wdeprecated-copy") #pragma clang diagnostic pop #endif +#endif #endif // GTEST_HAS_PARAM_TEST