-
Notifications
You must be signed in to change notification settings - Fork 986
[iwyu] Fixing inclusions for string_util.h
pt.1
#29376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
[puLL-Merge] - brave/brave-core@29376 DescriptionThis PR is performing a cleanup of unused ChangesChangesThe PR modifies 67 files across various components of the Brave browser: Removed includes (files that don't use string_util functions):
Added includes (files that use string_util functions but were missing the include):
sequenceDiagram
participant Developer
participant BuildSystem
participant CompilerCache
participant Dependencies
Developer->>BuildSystem: Submit PR with include cleanup
BuildSystem->>Dependencies: Analyze include dependencies
Dependencies->>Dependencies: Remove unused string_util.h includes
Dependencies->>Dependencies: Add missing string_util.h includes where needed
Dependencies->>CompilerCache: Reduce unnecessary header dependencies
CompilerCache->>BuildSystem: Faster compilation due to reduced includes
BuildSystem->>Developer: Build completes successfully
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wallet++
Files that use functions from `string_util.h` should include that header directly instead of relying on transient inclusions. This is a mechanical change using this script: ```sh remove_header_if_unused() { files=$(git grep -l "base/strings/string_util.h") for file in $files; do if ! git grep -qE "base::MakeStringPiece|base::MakeWStringView|base::ToLowerASCII|base::ToUpperASCII|base::CompareCaseInsensitiveASCII|base::EqualsCaseInsensitiveASCII|base::EmptyString|base::RemoveChars|base::ReplaceChars|base::TrimPositions|base::TrimString|base::TruncateUTF8ToByteSize|base::TrimWhitespace|base::CollapseWhitespace|base::ContainsOnlyChars|base::IsStringUTF8|base::IsStringASCII|base::EqualsASCII|base::CompareCase|base::StartsWith|base::EndsWith|base::RemovePrefix|base::RemoveSuffix|base::IsAscii|base::IsUnicodeControl|base::IsHexDigit|base::IsUnicodeWhitespace|base::FormatBytesUnlocalized|base::ReplaceFirstSubstringAfterOffset|base::ReplaceSubstringsAfterOffset|base::WriteInto|base::JoinString|base::ReplaceStringPlaceholders|base::MakeStringViewWithNulChars" "$file"; then sed -i '/base\/strings\/string_util.h/d' "$file" echo "Removed 'base/strings/string_util.h' from $file" fi done } add_header_if_needed() { files=$(git grep -lE "base::MakeStringPiece|base::MakeWStringView|base::ToLowerASCII|base::ToUpperASCII|base::CompareCaseInsensitiveASCII|base::EqualsCaseInsensitiveASCII|base::EmptyString|base::RemoveChars|base::ReplaceChars|base::TrimPositions|base::TrimString|base::TruncateUTF8ToByteSize|base::TrimWhitespace|base::CollapseWhitespace|base::ContainsOnlyChars|base::IsStringUTF8|base::IsStringASCII|base::EqualsASCII|base::CompareCase|base::StartsWith|base::EndsWith|base::RemovePrefix|base::RemoveSuffix|base::IsAscii|base::IsUnicodeControl|base::IsHexDigit|base::IsUnicodeWhitespace|base::FormatBytesUnlocalized|base::ReplaceFirstSubstringAfterOffset|base::ReplaceSubstringsAfterOffset|base::WriteInto|base::JoinString|base::ReplaceStringPlaceholders|base::MakeStringViewWithNulChars") for file in $files; do ../tools/add_header.py --header '"base/strings/string_util.h"' "$file" done } remove_header_if_unused add_header_if_needed ``` Resolves brave/brave-browser#46559
3e1ff0e
to
e36a488
Compare
Released in v1.81.47 |
Files that use functions from
string_util.h
should include that header directly instead of relying on transient inclusions.This is a mechanical change using this script:
Resolves brave/brave-browser#46559