From 76b855d845231c72887e40ea46aefdcde4fb34ba Mon Sep 17 00:00:00 2001 From: Kirill Bobyrev Date: Wed, 9 Feb 2022 11:05:58 +0100 Subject: [PATCH] [llvm] Add IWYU pragmas to GTest This will allow using tools like Include-What-You-Use and clangd IncludeCleaner. The tools will correctly identify the public headers responsible for importing symbols in the testing code. This is a backport of https://github.com/google/googletest/commit/100f6fbf5f81a82d163c1e29735e8a2936eacd4f The only untouched file from that patch is googletest/include/gtest/gtest_prod.h because the change is unrelated. Reviewed By: sammccall Differential Revision: https://reviews.llvm.org/D119320 --- llvm/utils/unittest/googlemock/README.LLVM | 1 + .../unittest/googlemock/include/gmock/gmock-actions.h | 2 +- .../googlemock/include/gmock/gmock-cardinalities.h | 1 + .../googlemock/include/gmock/gmock-function-mocker.h | 3 +++ .../unittest/googlemock/include/gmock/gmock-matchers.h | 1 + .../unittest/googlemock/include/gmock/gmock-more-actions.h | 1 + .../googlemock/include/gmock/gmock-more-matchers.h | 2 +- .../unittest/googlemock/include/gmock/gmock-nice-strict.h | 4 +++- .../googlemock/include/gmock/gmock-spec-builders.h | 2 +- llvm/utils/unittest/googlemock/include/gmock/gmock.h | 2 +- .../gmock/internal/custom/gmock-generated-actions.h | 3 +++ .../include/gmock/internal/custom/gmock-matchers.h | 3 +++ .../googlemock/include/gmock/internal/custom/gmock-port.h | 3 +++ .../include/gmock/internal/gmock-internal-utils.h | 1 + .../googlemock/include/gmock/internal/gmock-port.h | 2 +- llvm/utils/unittest/googletest/README.LLVM | 1 + .../unittest/googletest/include/gtest/gtest-death-test.h | 4 ++++ .../unittest/googletest/include/gtest/gtest-matchers.h | 6 +++--- .../unittest/googletest/include/gtest/gtest-message.h | 5 ++++- .../unittest/googletest/include/gtest/gtest-param-test.h | 5 +++++ .../unittest/googletest/include/gtest/gtest-printers.h | 5 ++++- llvm/utils/unittest/googletest/include/gtest/gtest-spi.h | 1 - .../unittest/googletest/include/gtest/gtest-test-part.h | 4 ++++ .../unittest/googletest/include/gtest/gtest-typed-test.h | 3 +++ llvm/utils/unittest/googletest/include/gtest/gtest.h | 7 +++---- .../unittest/googletest/include/gtest/gtest_pred_impl.h | 4 ++++ .../include/gtest/internal/gtest-death-test-internal.h | 4 ++++ .../googletest/include/gtest/internal/gtest-filepath.h | 6 +++++- .../googletest/include/gtest/internal/gtest-internal.h | 4 ++++ .../googletest/include/gtest/internal/gtest-param-util.h | 4 ++++ .../googletest/include/gtest/internal/gtest-port-arch.h | 6 +++++- .../googletest/include/gtest/internal/gtest-port.h | 6 +++++- .../googletest/include/gtest/internal/gtest-string.h | 6 +++++- .../googletest/include/gtest/internal/gtest-type-util.h | 4 ++++ 34 files changed, 96 insertions(+), 20 deletions(-) diff --git a/llvm/utils/unittest/googlemock/README.LLVM b/llvm/utils/unittest/googlemock/README.LLVM index dbeb4af08e94..1fb6f4776e81 100644 --- a/llvm/utils/unittest/googlemock/README.LLVM +++ b/llvm/utils/unittest/googlemock/README.LLVM @@ -20,3 +20,4 @@ Modified as follows: * Support for std::begin/std::end in gmock-matchers.h * IWYU pragmas * Disabled -Wdeprecated-copy for clang +* Added IWYU pragmas from https://github.com/google/googletest/commit/100f6fbf5f81a82d163c1e29735e8a2936eacd4f diff --git a/llvm/utils/unittest/googlemock/include/gmock/gmock-actions.h b/llvm/utils/unittest/googlemock/include/gmock/gmock-actions.h index 52624cd63399..de58b18edc1d 100644 --- a/llvm/utils/unittest/googlemock/include/gmock/gmock-actions.h +++ b/llvm/utils/unittest/googlemock/include/gmock/gmock-actions.h @@ -27,7 +27,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - // Google Mock - a framework for writing C++ mock classes. // // This file implements some commonly used actions. @@ -35,6 +34,7 @@ // GOOGLETEST_CM0002 DO NOT DELETE // IWYU pragma: private, include "gmock/gmock.h" +// IWYU pragma: friend gmock/.* #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_ #define GMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_ diff --git a/llvm/utils/unittest/googlemock/include/gmock/gmock-cardinalities.h b/llvm/utils/unittest/googlemock/include/gmock/gmock-cardinalities.h index 05b66d4fffdc..32c57b3b3272 100644 --- a/llvm/utils/unittest/googlemock/include/gmock/gmock-cardinalities.h +++ b/llvm/utils/unittest/googlemock/include/gmock/gmock-cardinalities.h @@ -37,6 +37,7 @@ // GOOGLETEST_CM0002 DO NOT DELETE // IWYU pragma: private, include "gmock/gmock.h" +// IWYU pragma: friend gmock/.* #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_ #define GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_ diff --git a/llvm/utils/unittest/googlemock/include/gmock/gmock-function-mocker.h b/llvm/utils/unittest/googlemock/include/gmock/gmock-function-mocker.h index cc1535c806bf..18127b844c57 100644 --- a/llvm/utils/unittest/googlemock/include/gmock/gmock-function-mocker.h +++ b/llvm/utils/unittest/googlemock/include/gmock/gmock-function-mocker.h @@ -33,6 +33,9 @@ // GOOGLETEST_CM0002 DO NOT DELETE +// IWYU pragma: private, include "gmock/gmock.h" +// IWYU pragma: friend gmock/.* + #ifndef THIRD_PARTY_GOOGLETEST_GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_FUNCTION_MOCKER_H_ // NOLINT #define THIRD_PARTY_GOOGLETEST_GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_FUNCTION_MOCKER_H_ // NOLINT diff --git a/llvm/utils/unittest/googlemock/include/gmock/gmock-matchers.h b/llvm/utils/unittest/googlemock/include/gmock/gmock-matchers.h index 8c604cf14f15..8d636f48c67d 100644 --- a/llvm/utils/unittest/googlemock/include/gmock/gmock-matchers.h +++ b/llvm/utils/unittest/googlemock/include/gmock/gmock-matchers.h @@ -40,6 +40,7 @@ // GOOGLETEST_CM0002 DO NOT DELETE // IWYU pragma: private, include "gmock/gmock.h" +// IWYU pragma: friend gmock/.* #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_MATCHERS_H_ #define GMOCK_INCLUDE_GMOCK_GMOCK_MATCHERS_H_ diff --git a/llvm/utils/unittest/googlemock/include/gmock/gmock-more-actions.h b/llvm/utils/unittest/googlemock/include/gmock/gmock-more-actions.h index 56de2d10681a..f6ee4a68c032 100644 --- a/llvm/utils/unittest/googlemock/include/gmock/gmock-more-actions.h +++ b/llvm/utils/unittest/googlemock/include/gmock/gmock-more-actions.h @@ -35,6 +35,7 @@ // GOOGLETEST_CM0002 DO NOT DELETE // IWYU pragma: private, include "gmock/gmock.h" +// IWYU pragma: friend gmock/.* #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_MORE_ACTIONS_H_ #define GMOCK_INCLUDE_GMOCK_GMOCK_MORE_ACTIONS_H_ diff --git a/llvm/utils/unittest/googlemock/include/gmock/gmock-more-matchers.h b/llvm/utils/unittest/googlemock/include/gmock/gmock-more-matchers.h index 5b29a9d024df..e96bd21d714e 100644 --- a/llvm/utils/unittest/googlemock/include/gmock/gmock-more-matchers.h +++ b/llvm/utils/unittest/googlemock/include/gmock/gmock-more-matchers.h @@ -27,7 +27,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - // Google Mock - a framework for writing C++ mock classes. // // This file implements some matchers that depend on gmock-generated-matchers.h. @@ -38,6 +37,7 @@ // GOOGLETEST_CM0002 DO NOT DELETE // IWYU pragma: private, include "gmock/gmock.h" +// IWYU pragma: friend gmock/.* #ifndef GMOCK_INCLUDE_GMOCK_MORE_MATCHERS_H_ #define GMOCK_INCLUDE_GMOCK_MORE_MATCHERS_H_ diff --git a/llvm/utils/unittest/googlemock/include/gmock/gmock-nice-strict.h b/llvm/utils/unittest/googlemock/include/gmock/gmock-nice-strict.h index 5495a9805b5f..140fc19fcd7d 100644 --- a/llvm/utils/unittest/googlemock/include/gmock/gmock-nice-strict.h +++ b/llvm/utils/unittest/googlemock/include/gmock/gmock-nice-strict.h @@ -27,7 +27,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - // Implements class templates NiceMock, NaggyMock, and StrictMock. // // Given a mock class MockFoo that is created using Google Mock, @@ -60,6 +59,9 @@ // GOOGLETEST_CM0002 DO NOT DELETE +// IWYU pragma: private, include "gmock/gmock.h" +// IWYU pragma: friend gmock/.* + #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_NICE_STRICT_H_ #define GMOCK_INCLUDE_GMOCK_GMOCK_NICE_STRICT_H_ diff --git a/llvm/utils/unittest/googlemock/include/gmock/gmock-spec-builders.h b/llvm/utils/unittest/googlemock/include/gmock/gmock-spec-builders.h index 4fc4a546ef27..80b0b8726fc6 100644 --- a/llvm/utils/unittest/googlemock/include/gmock/gmock-spec-builders.h +++ b/llvm/utils/unittest/googlemock/include/gmock/gmock-spec-builders.h @@ -27,7 +27,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - // Google Mock - a framework for writing C++ mock classes. // // This file implements the ON_CALL() and EXPECT_CALL() macros. @@ -59,6 +58,7 @@ // GOOGLETEST_CM0002 DO NOT DELETE // IWYU pragma: private, include "gmock/gmock.h" +// IWYU pragma: friend gmock/.* #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_ #define GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_ diff --git a/llvm/utils/unittest/googlemock/include/gmock/gmock.h b/llvm/utils/unittest/googlemock/include/gmock/gmock.h index 45645ff63777..57469a0db89e 100644 --- a/llvm/utils/unittest/googlemock/include/gmock/gmock.h +++ b/llvm/utils/unittest/googlemock/include/gmock/gmock.h @@ -27,7 +27,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - // Google Mock - a framework for writing C++ mock classes. // // This is the main header file a user should include. @@ -67,6 +66,7 @@ #include "gmock/gmock-more-matchers.h" #include "gmock/gmock-nice-strict.h" #include "gmock/internal/gmock-internal-utils.h" +#include "gmock/internal/gmock-port.h" #ifdef __clang__ #if __has_warning("-Wdeprecated-copy") diff --git a/llvm/utils/unittest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h b/llvm/utils/unittest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h index 92d910cf06df..4e381faf4084 100644 --- a/llvm/utils/unittest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h +++ b/llvm/utils/unittest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h @@ -4,6 +4,9 @@ // GOOGLETEST_CM0002 DO NOT DELETE +// IWYU pragma: private, include "gmock/gmock.h" +// IWYU pragma: friend gmock/.* + #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ #define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ diff --git a/llvm/utils/unittest/googlemock/include/gmock/internal/custom/gmock-matchers.h b/llvm/utils/unittest/googlemock/include/gmock/internal/custom/gmock-matchers.h index 14aafaabe6b5..3a9b7cd31d4f 100644 --- a/llvm/utils/unittest/googlemock/include/gmock/internal/custom/gmock-matchers.h +++ b/llvm/utils/unittest/googlemock/include/gmock/internal/custom/gmock-matchers.h @@ -31,6 +31,9 @@ // // GOOGLETEST_CM0002 DO NOT DELETE +// IWYU pragma: private, include "gmock/gmock.h" +// IWYU pragma: friend gmock/.* + #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_MATCHERS_H_ #define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_MATCHERS_H_ #endif // GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_MATCHERS_H_ diff --git a/llvm/utils/unittest/googlemock/include/gmock/internal/custom/gmock-port.h b/llvm/utils/unittest/googlemock/include/gmock/internal/custom/gmock-port.h index 0030fe91118a..be78e2add8a0 100644 --- a/llvm/utils/unittest/googlemock/include/gmock/internal/custom/gmock-port.h +++ b/llvm/utils/unittest/googlemock/include/gmock/internal/custom/gmock-port.h @@ -33,6 +33,9 @@ // GOOGLETEST_CM0002 DO NOT DELETE +// IWYU pragma: private, include "gmock/gmock.h" +// IWYU pragma: friend gmock/.* + #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_ #define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_ diff --git a/llvm/utils/unittest/googlemock/include/gmock/internal/gmock-internal-utils.h b/llvm/utils/unittest/googlemock/include/gmock/internal/gmock-internal-utils.h index b9533508ef75..9ee68b7261bc 100644 --- a/llvm/utils/unittest/googlemock/include/gmock/internal/gmock-internal-utils.h +++ b/llvm/utils/unittest/googlemock/include/gmock/internal/gmock-internal-utils.h @@ -37,6 +37,7 @@ // GOOGLETEST_CM0002 DO NOT DELETE // IWYU pragma: private, include "gmock/gmock.h" +// IWYU pragma: friend gmock/.* #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_ #define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_ diff --git a/llvm/utils/unittest/googlemock/include/gmock/internal/gmock-port.h b/llvm/utils/unittest/googlemock/include/gmock/internal/gmock-port.h index 27e4c0caf2bc..cdb1c3ef62c5 100644 --- a/llvm/utils/unittest/googlemock/include/gmock/internal/gmock-port.h +++ b/llvm/utils/unittest/googlemock/include/gmock/internal/gmock-port.h @@ -27,7 +27,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// // Low-level types and utilities for porting Google Mock to various // platforms. All macros ending with _ and symbols defined in an // internal namespace are subject to change without notice. Code @@ -38,6 +37,7 @@ // GOOGLETEST_CM0002 DO NOT DELETE // IWYU pragma: private, include "gmock/gmock.h" +// IWYU pragma: friend gmock/.* #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_ #define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_ diff --git a/llvm/utils/unittest/googletest/README.LLVM b/llvm/utils/unittest/googletest/README.LLVM index fea59e5e0689..3bc41c9ee3a2 100644 --- a/llvm/utils/unittest/googletest/README.LLVM +++ b/llvm/utils/unittest/googletest/README.LLVM @@ -19,3 +19,4 @@ Modified as follows: * Added support for NetBSD, Minix and Haiku. * Added raw_os_ostream support to include/gtest/internal/custom/gtest-printers.h. * Added StringRef support to include/gtest/internal/custom/gtest-printers.h. +* Added IWYU pragmas from https://github.com/google/googletest/commit/100f6fbf5f81a82d163c1e29735e8a2936eacd4f diff --git a/llvm/utils/unittest/googletest/include/gtest/gtest-death-test.h b/llvm/utils/unittest/googletest/include/gtest/gtest-death-test.h index dc878ffbb3ae..1b89d84de3ca 100644 --- a/llvm/utils/unittest/googletest/include/gtest/gtest-death-test.h +++ b/llvm/utils/unittest/googletest/include/gtest/gtest-death-test.h @@ -35,6 +35,10 @@ // directly. // GOOGLETEST_CM0001 DO NOT DELETE +// IWYU pragma: private, include "gtest/gtest.h" +// IWYU pragma: friend gtest/.* +// IWYU pragma: friend gmock/.* + #ifndef GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_ #define GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_ diff --git a/llvm/utils/unittest/googletest/include/gtest/gtest-matchers.h b/llvm/utils/unittest/googletest/include/gtest/gtest-matchers.h index 9de6c2e10a20..667d16e6e727 100644 --- a/llvm/utils/unittest/googletest/include/gtest/gtest-matchers.h +++ b/llvm/utils/unittest/googletest/include/gtest/gtest-matchers.h @@ -32,9 +32,9 @@ // This file implements just enough of the matcher interface to allow // EXPECT_DEATH and friends to accept a matcher argument. -// IWYU pragma: private, include "testing/base/public/gunit.h" -// IWYU pragma: friend third_party/googletest/googlemock/.* -// IWYU pragma: friend third_party/googletest/googletest/.* +// // IWYU pragma: private, include "gtest/gtest.h" +// IWYU pragma: friend gtest/.* +// IWYU pragma: friend gmock/.* #ifndef GTEST_INCLUDE_GTEST_GTEST_MATCHERS_H_ #define GTEST_INCLUDE_GTEST_GTEST_MATCHERS_H_ diff --git a/llvm/utils/unittest/googletest/include/gtest/gtest-message.h b/llvm/utils/unittest/googletest/include/gtest/gtest-message.h index cbabe5defd77..5802907f9395 100644 --- a/llvm/utils/unittest/googletest/include/gtest/gtest-message.h +++ b/llvm/utils/unittest/googletest/include/gtest/gtest-message.h @@ -27,7 +27,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// // The Google C++ Testing and Mocking Framework (Google Test) // // This header file defines the Message class. @@ -44,6 +43,10 @@ // GOOGLETEST_CM0001 DO NOT DELETE +// IWYU pragma: private, include "gtest/gtest.h" +// IWYU pragma: friend gtest/.* +// IWYU pragma: friend gmock/.* + #ifndef GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_ #define GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_ diff --git a/llvm/utils/unittest/googletest/include/gtest/gtest-param-test.h b/llvm/utils/unittest/googletest/include/gtest/gtest-param-test.h index c2e6eae3d832..7bcf60c47a30 100644 --- a/llvm/utils/unittest/googletest/include/gtest/gtest-param-test.h +++ b/llvm/utils/unittest/googletest/include/gtest/gtest-param-test.h @@ -33,6 +33,11 @@ // This file is generated by a SCRIPT. DO NOT EDIT BY HAND! // // GOOGLETEST_CM0001 DO NOT DELETE + +// IWYU pragma: private, include "gtest/gtest.h" +// IWYU pragma: friend gtest/.* +// IWYU pragma: friend gmock/.* + #ifndef GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_ #define GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_ diff --git a/llvm/utils/unittest/googletest/include/gtest/gtest-printers.h b/llvm/utils/unittest/googletest/include/gtest/gtest-printers.h index 956f07910484..8479435ac7e6 100644 --- a/llvm/utils/unittest/googletest/include/gtest/gtest-printers.h +++ b/llvm/utils/unittest/googletest/include/gtest/gtest-printers.h @@ -27,7 +27,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - // Google Test - The Google C++ Testing and Mocking Framework // // This file implements a universal value printer that can print a @@ -97,6 +96,10 @@ // GOOGLETEST_CM0001 DO NOT DELETE +// IWYU pragma: private, include "gtest/gtest.h" +// IWYU pragma: friend gtest/.* +// IWYU pragma: friend gmock/.* + #ifndef GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_ #define GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_ diff --git a/llvm/utils/unittest/googletest/include/gtest/gtest-spi.h b/llvm/utils/unittest/googletest/include/gtest/gtest-spi.h index aa38870e8e1c..4849e433fca7 100644 --- a/llvm/utils/unittest/googletest/include/gtest/gtest-spi.h +++ b/llvm/utils/unittest/googletest/include/gtest/gtest-spi.h @@ -27,7 +27,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// // Utilities for testing Google Test itself and code that uses Google Test // (e.g. frameworks built on top of Google Test). diff --git a/llvm/utils/unittest/googletest/include/gtest/gtest-test-part.h b/llvm/utils/unittest/googletest/include/gtest/gtest-test-part.h index 05a79853586a..53526c98ee89 100644 --- a/llvm/utils/unittest/googletest/include/gtest/gtest-test-part.h +++ b/llvm/utils/unittest/googletest/include/gtest/gtest-test-part.h @@ -29,6 +29,10 @@ // // GOOGLETEST_CM0001 DO NOT DELETE +// IWYU pragma: private, include "gtest/gtest.h" +// IWYU pragma: friend gtest/.* +// IWYU pragma: friend gmock/.* + #ifndef GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_ #define GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_ diff --git a/llvm/utils/unittest/googletest/include/gtest/gtest-typed-test.h b/llvm/utils/unittest/googletest/include/gtest/gtest-typed-test.h index 095ce058022f..891f02e2a2fe 100644 --- a/llvm/utils/unittest/googletest/include/gtest/gtest-typed-test.h +++ b/llvm/utils/unittest/googletest/include/gtest/gtest-typed-test.h @@ -27,6 +27,9 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// IWYU pragma: private, include "gtest/gtest.h" +// IWYU pragma: friend gtest/.* +// IWYU pragma: friend gmock/.* // GOOGLETEST_CM0001 DO NOT DELETE diff --git a/llvm/utils/unittest/googletest/include/gtest/gtest.h b/llvm/utils/unittest/googletest/include/gtest/gtest.h index dbe5b1c2c3f6..eb5c5cc0d0b6 100644 --- a/llvm/utils/unittest/googletest/include/gtest/gtest.h +++ b/llvm/utils/unittest/googletest/include/gtest/gtest.h @@ -27,7 +27,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// // The Google C++ Testing and Mocking Framework (Google Test) // // This header file defines the public API for Google Test. It should be @@ -59,16 +58,16 @@ #include #include -#include "gtest/internal/gtest-internal.h" -#include "gtest/internal/gtest-string.h" #include "gtest/gtest-death-test.h" #include "gtest/gtest-matchers.h" #include "gtest/gtest-message.h" #include "gtest/gtest-param-test.h" #include "gtest/gtest-printers.h" -#include "gtest/gtest_prod.h" #include "gtest/gtest-test-part.h" #include "gtest/gtest-typed-test.h" +#include "gtest/gtest_prod.h" +#include "gtest/internal/gtest-internal.h" +#include "gtest/internal/gtest-string.h" GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ /* class A needs to have dll-interface to be used by clients of class B */) diff --git a/llvm/utils/unittest/googletest/include/gtest/gtest_pred_impl.h b/llvm/utils/unittest/googletest/include/gtest/gtest_pred_impl.h index d514255c733b..50c156e664eb 100644 --- a/llvm/utils/unittest/googletest/include/gtest/gtest_pred_impl.h +++ b/llvm/utils/unittest/googletest/include/gtest/gtest_pred_impl.h @@ -33,6 +33,10 @@ // Implements a family of generic predicate assertion macros. // GOOGLETEST_CM0001 DO NOT DELETE +// IWYU pragma: private, include "gtest/gtest.h" +// IWYU pragma: friend gtest/.* +// IWYU pragma: friend gmock/.* + #ifndef GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_ #define GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_ diff --git a/llvm/utils/unittest/googletest/include/gtest/internal/gtest-death-test-internal.h b/llvm/utils/unittest/googletest/include/gtest/internal/gtest-death-test-internal.h index 12bb05011f96..052dc978252e 100644 --- a/llvm/utils/unittest/googletest/include/gtest/internal/gtest-death-test-internal.h +++ b/llvm/utils/unittest/googletest/include/gtest/internal/gtest-death-test-internal.h @@ -33,6 +33,10 @@ // death tests. They are subject to change without notice. // GOOGLETEST_CM0001 DO NOT DELETE +// IWYU pragma: private, include "gtest/gtest.h" +// IWYU pragma: friend gtest/.* +// IWYU pragma: friend gmock/.* + #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_ diff --git a/llvm/utils/unittest/googletest/include/gtest/internal/gtest-filepath.h b/llvm/utils/unittest/googletest/include/gtest/internal/gtest-filepath.h index c11b101516e5..ca60a70d15b4 100644 --- a/llvm/utils/unittest/googletest/include/gtest/internal/gtest-filepath.h +++ b/llvm/utils/unittest/googletest/include/gtest/internal/gtest-filepath.h @@ -26,7 +26,7 @@ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// + // Google Test filepath utilities // // This header file declares classes and functions used internally by @@ -37,6 +37,10 @@ // GOOGLETEST_CM0001 DO NOT DELETE +// IWYU pragma: private, include "gtest/gtest.h" +// IWYU pragma: friend gtest/.* +// IWYU pragma: friend gmock/.* + #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_ diff --git a/llvm/utils/unittest/googletest/include/gtest/internal/gtest-internal.h b/llvm/utils/unittest/googletest/include/gtest/internal/gtest-internal.h index 94c816a28bdb..d861a0a4f76f 100644 --- a/llvm/utils/unittest/googletest/include/gtest/internal/gtest-internal.h +++ b/llvm/utils/unittest/googletest/include/gtest/internal/gtest-internal.h @@ -34,6 +34,10 @@ // GOOGLETEST_CM0001 DO NOT DELETE +// IWYU pragma: private, include "gtest/gtest.h" +// IWYU pragma: friend gtest/.* +// IWYU pragma: friend gmock/.* + #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_ diff --git a/llvm/utils/unittest/googletest/include/gtest/internal/gtest-param-util.h b/llvm/utils/unittest/googletest/include/gtest/internal/gtest-param-util.h index 97533993c0c3..f90b6422d667 100644 --- a/llvm/utils/unittest/googletest/include/gtest/internal/gtest-param-util.h +++ b/llvm/utils/unittest/googletest/include/gtest/internal/gtest-param-util.h @@ -32,6 +32,10 @@ // GOOGLETEST_CM0001 DO NOT DELETE +// IWYU pragma: private, include "gtest/gtest.h" +// IWYU pragma: friend gtest/.* +// IWYU pragma: friend gmock/.* + #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_ diff --git a/llvm/utils/unittest/googletest/include/gtest/internal/gtest-port-arch.h b/llvm/utils/unittest/googletest/include/gtest/internal/gtest-port-arch.h index cece93dba12d..357cffc13c80 100644 --- a/llvm/utils/unittest/googletest/include/gtest/internal/gtest-port-arch.h +++ b/llvm/utils/unittest/googletest/include/gtest/internal/gtest-port-arch.h @@ -26,12 +26,16 @@ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// + // The Google C++ Testing and Mocking Framework (Google Test) // // This header file defines the GTEST_OS_* macro. // It is separate from gtest-port.h so that custom/gtest-port.h can include it. +// IWYU pragma: private, include "gtest/gtest.h" +// IWYU pragma: friend gtest/.* +// IWYU pragma: friend gmock/.* + #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_ diff --git a/llvm/utils/unittest/googletest/include/gtest/internal/gtest-port.h b/llvm/utils/unittest/googletest/include/gtest/internal/gtest-port.h index 063fcb1083ba..9ec07b8d4a6a 100644 --- a/llvm/utils/unittest/googletest/include/gtest/internal/gtest-port.h +++ b/llvm/utils/unittest/googletest/include/gtest/internal/gtest-port.h @@ -26,7 +26,7 @@ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// + // Low-level types and utilities for porting Google Test to various // platforms. All macros ending with _ and symbols defined in an // internal namespace are subject to change without notice. Code @@ -40,6 +40,10 @@ // GOOGLETEST_CM0001 DO NOT DELETE +// IWYU pragma: private, include "gtest/gtest.h" +// IWYU pragma: friend gtest/.* +// IWYU pragma: friend gmock/.* + #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_ diff --git a/llvm/utils/unittest/googletest/include/gtest/internal/gtest-string.h b/llvm/utils/unittest/googletest/include/gtest/internal/gtest-string.h index 82aaa63bf465..66ef15dc1dea 100644 --- a/llvm/utils/unittest/googletest/include/gtest/internal/gtest-string.h +++ b/llvm/utils/unittest/googletest/include/gtest/internal/gtest-string.h @@ -26,7 +26,7 @@ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// + // The Google C++ Testing and Mocking Framework (Google Test) // // This header file declares the String class and functions used internally by @@ -38,6 +38,10 @@ // GOOGLETEST_CM0001 DO NOT DELETE +// IWYU pragma: private, include "gtest/gtest.h" +// IWYU pragma: friend gtest/.* +// IWYU pragma: friend gmock/.* + #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_ diff --git a/llvm/utils/unittest/googletest/include/gtest/internal/gtest-type-util.h b/llvm/utils/unittest/googletest/include/gtest/internal/gtest-type-util.h index 3d7542d1fb35..892378a85f5c 100644 --- a/llvm/utils/unittest/googletest/include/gtest/internal/gtest-type-util.h +++ b/llvm/utils/unittest/googletest/include/gtest/internal/gtest-type-util.h @@ -41,6 +41,10 @@ // GOOGLETEST_CM0001 DO NOT DELETE +// IWYU pragma: private, include "gtest/gtest.h" +// IWYU pragma: friend gtest/.* +// IWYU pragma: friend gmock/.* + #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_