Minimize heavy STL headers in GoogleTest and GoogleMock public headers#4947
Open
unseen2004 wants to merge 1 commit intogoogle:mainfrom
Open
Minimize heavy STL headers in GoogleTest and GoogleMock public headers#4947unseen2004 wants to merge 1 commit intogoogle:mainfrom
unseen2004 wants to merge 1 commit intogoogle:mainfrom
Conversation
This change reduces compilation time by replacing heavy headers like <ostream> and <sstream> with <iosfwd> in public headers. Key changes: - Introduced internal::StreamTo helper functions to handle streaming common types without requiring <ostream> in headers. - Updated GoogleTest and GoogleMock public headers to use <iosfwd>. - Refactored StringMatchResultListener to hide its std::stringstream implementation in gmock-matchers.cc. - Moved non-template PrintTo overloads to .cc files. Fixes google#4943.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
This PR addresses Issue #4943 (#4943) by minimizing the inclusion of heavy standard library headers like
and in public GoogleTest and GoogleMock headers. This should significantly improve compilation times for projects with many test
translation units.
Key Changes:
strings, etc.) without requiring the full definition of std::ostream.
(gmock-matchers.cc) using a std::unique_ptrstd::ostream, hiding the heavy dependency from the public header.
Verification:
Fixes #4943