CXX-3089 Ensure <string> is included in all components using std::string #1193
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.
Resolves CXX-3089. Supercedes #1192. Verified by this patch.
Requesting an additional review from @vorlac to validate these changes in their environment. (I am unable to add you to the list of reviewers.)
<string_view>
is not specified to include<string>
. The STL changes cited in #1192 exposed pre-existing Include What You Use (IWYU) violations in C++ Driver headers (use ofstd::string
without including<string>
).This PR fixes all IWYU violations for
std::string
(only!) in library code (not tests, examples, etc.). To keep the diff small, the include is added to the "top-most" layer of each component:.cpp
usesstd::string
, include<string>
unless its header(s) already includes it.std::string
, include<string>
unless its public header includes it.std::string
, include<string>
unless a fundamentally dependent header includes it.Note
I am of the opinion that every file, regardless of component membership or hierarchy, should IWYU, but this PR is deliberately kept small and focused. Auditing and addressing standalone inclusion and IWYU issues can be deferred to a followup task/PR.
The only case of the "unless" in the last bullet point is with the BSON document builder headers. All the builders directly depend on
<bsoncxx/builder/core.hpp>
, thus the<string>
is added only tocore.hpp
to cover for all the dependent builder headers.Some additional non-
<string>
include directives were added to the index_view and search_index_view components to properly satisfy their component include hierarchy.