[llvm] 76b855d - [llvm] Add IWYU pragmas to GTest

Kirill Bobyrev via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 9 02:06:08 PST 2022


Author: Kirill Bobyrev
Date: 2022-02-09T11:05:59+01:00
New Revision: 76b855d845231c72887e40ea46aefdcde4fb34ba

URL: https://github.com/llvm/llvm-project/commit/76b855d845231c72887e40ea46aefdcde4fb34ba
DIFF: https://github.com/llvm/llvm-project/commit/76b855d845231c72887e40ea46aefdcde4fb34ba.diff

LOG: [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

Added: 
    

Modified: 
    llvm/utils/unittest/googlemock/README.LLVM
    llvm/utils/unittest/googlemock/include/gmock/gmock-actions.h
    llvm/utils/unittest/googlemock/include/gmock/gmock-cardinalities.h
    llvm/utils/unittest/googlemock/include/gmock/gmock-function-mocker.h
    llvm/utils/unittest/googlemock/include/gmock/gmock-matchers.h
    llvm/utils/unittest/googlemock/include/gmock/gmock-more-actions.h
    llvm/utils/unittest/googlemock/include/gmock/gmock-more-matchers.h
    llvm/utils/unittest/googlemock/include/gmock/gmock-nice-strict.h
    llvm/utils/unittest/googlemock/include/gmock/gmock-spec-builders.h
    llvm/utils/unittest/googlemock/include/gmock/gmock.h
    llvm/utils/unittest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h
    llvm/utils/unittest/googlemock/include/gmock/internal/custom/gmock-matchers.h
    llvm/utils/unittest/googlemock/include/gmock/internal/custom/gmock-port.h
    llvm/utils/unittest/googlemock/include/gmock/internal/gmock-internal-utils.h
    llvm/utils/unittest/googlemock/include/gmock/internal/gmock-port.h
    llvm/utils/unittest/googletest/README.LLVM
    llvm/utils/unittest/googletest/include/gtest/gtest-death-test.h
    llvm/utils/unittest/googletest/include/gtest/gtest-matchers.h
    llvm/utils/unittest/googletest/include/gtest/gtest-message.h
    llvm/utils/unittest/googletest/include/gtest/gtest-param-test.h
    llvm/utils/unittest/googletest/include/gtest/gtest-printers.h
    llvm/utils/unittest/googletest/include/gtest/gtest-spi.h
    llvm/utils/unittest/googletest/include/gtest/gtest-test-part.h
    llvm/utils/unittest/googletest/include/gtest/gtest-typed-test.h
    llvm/utils/unittest/googletest/include/gtest/gtest.h
    llvm/utils/unittest/googletest/include/gtest/gtest_pred_impl.h
    llvm/utils/unittest/googletest/include/gtest/internal/gtest-death-test-internal.h
    llvm/utils/unittest/googletest/include/gtest/internal/gtest-filepath.h
    llvm/utils/unittest/googletest/include/gtest/internal/gtest-internal.h
    llvm/utils/unittest/googletest/include/gtest/internal/gtest-param-util.h
    llvm/utils/unittest/googletest/include/gtest/internal/gtest-port-arch.h
    llvm/utils/unittest/googletest/include/gtest/internal/gtest-port.h
    llvm/utils/unittest/googletest/include/gtest/internal/gtest-string.h
    llvm/utils/unittest/googletest/include/gtest/internal/gtest-type-util.h

Removed: 
    


################################################################################
diff  --git a/llvm/utils/unittest/googlemock/README.LLVM b/llvm/utils/unittest/googlemock/README.LLVM
index dbeb4af08e948..1fb6f4776e81f 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 52624cd63399d..de58b18edc1d8 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 05b66d4fffdc8..32c57b3b32724 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 cc1535c806bf4..18127b844c574 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 8c604cf14f150..8d636f48c67d6 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 56de2d10681a0..f6ee4a68c0329 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 5b29a9d024dff..e96bd21d714e1 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 5495a9805b5fa..140fc19fcd7dc 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 4fc4a546ef272..80b0b8726fc61 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 45645ff637779..57469a0db89ed 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 92d910cf06dfe..4e381faf4084b 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 14aafaabe6b52..3a9b7cd31d4f1 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 0030fe91118a5..be78e2add8a0c 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 b9533508ef757..9ee68b7261bc4 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 27e4c0caf2bcc..cdb1c3ef62c5f 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 fea59e5e06899..3bc41c9ee3a2f 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 dc878ffbb3ae5..1b89d84de3ca0 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 9de6c2e10a20d..667d16e6e7276 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 cbabe5defd77d..5802907f93953 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 c2e6eae3d8326..7bcf60c47a307 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 956f07910484a..8479435ac7e61 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 aa38870e8e1c9..4849e433fca76 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 05a79853586a9..53526c98ee891 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 095ce058022f8..891f02e2a2feb 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 dbe5b1c2c3f64..eb5c5cc0d0b6c 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 <type_traits>
 #include <vector>
 
-#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 d514255c733b7..50c156e664ebe 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 12bb05011f96b..052dc978252e1 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 c11b101516e53..ca60a70d15b4f 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 94c816a28bdb1..d861a0a4f76ff 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 97533993c0c3c..f90b6422d6672 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 cece93dba12d4..357cffc13c809 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 063fcb1083bab..9ec07b8d4a6ad 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 82aaa63bf4657..66ef15dc1dea1 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 3d7542d1fb350..892378a85f5cb 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_
 


        


More information about the llvm-commits mailing list