From 5495534331d2e163aab69b82d1c5f5677eb67b1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Mon, 15 Aug 2022 12:59:03 +0000 Subject: [PATCH] Bug 1784490 - Part 1: Remove unnecessary includes in js/src/builtin/intl. r=mgaudet Remove unnecessary includes reported by IWYU, but don't bother with adding all missing includes, because that requires more effort to filter out invalid suggestions from IWYU. The added includes are only needed to avoid build breakage. Differential Revision: https://phabricator.services.mozilla.com/D154534 --- js/src/builtin/intl/Collator.cpp | 1 - js/src/builtin/intl/CommonFunctions.cpp | 7 +++---- js/src/builtin/intl/CommonFunctions.h | 10 ++++------ js/src/builtin/intl/DateTimeFormat.cpp | 4 ---- js/src/builtin/intl/DateTimeFormat.h | 2 -- js/src/builtin/intl/DisplayNames.cpp | 11 +---------- js/src/builtin/intl/DisplayNames.h | 2 -- js/src/builtin/intl/IntlObject.cpp | 9 +-------- js/src/builtin/intl/IntlObject.h | 1 - js/src/builtin/intl/LanguageTag.cpp | 2 -- js/src/builtin/intl/LanguageTag.h | 4 ---- js/src/builtin/intl/ListFormat.cpp | 4 ---- js/src/builtin/intl/ListFormat.h | 1 - js/src/builtin/intl/Locale.cpp | 3 --- js/src/builtin/intl/Locale.h | 1 - js/src/builtin/intl/NumberFormat.cpp | 6 ------ js/src/builtin/intl/NumberFormat.h | 2 -- js/src/builtin/intl/PluralRules.cpp | 2 -- js/src/builtin/intl/PluralRules.h | 1 - js/src/builtin/intl/RelativeTimeFormat.cpp | 1 - js/src/builtin/intl/RelativeTimeFormat.h | 1 - js/src/builtin/intl/SharedIntlData.cpp | 2 -- js/src/builtin/intl/SharedIntlData.h | 1 - js/src/builtin/intl/StringAsciiChars.h | 1 - 24 files changed, 9 insertions(+), 70 deletions(-) diff --git a/js/src/builtin/intl/Collator.cpp b/js/src/builtin/intl/Collator.cpp index ea1e894b8781..e748e78b63da 100644 --- a/js/src/builtin/intl/Collator.cpp +++ b/js/src/builtin/intl/Collator.cpp @@ -19,7 +19,6 @@ #include "builtin/intl/LanguageTag.h" #include "builtin/intl/SharedIntlData.h" #include "gc/GCContext.h" -#include "js/CharacterEncoding.h" #include "js/PropertySpec.h" #include "js/StableStringChars.h" #include "js/TypeDecls.h" diff --git a/js/src/builtin/intl/CommonFunctions.cpp b/js/src/builtin/intl/CommonFunctions.cpp index 5bd27621dc66..18bcd011ce06 100644 --- a/js/src/builtin/intl/CommonFunctions.cpp +++ b/js/src/builtin/intl/CommonFunctions.cpp @@ -9,14 +9,12 @@ #include "builtin/intl/CommonFunctions.h" #include "mozilla/Assertions.h" -#include "mozilla/Casting.h" -#include "mozilla/intl/ICU4CGlue.h" +#include "mozilla/intl/ICUError.h" #include "mozilla/TextUtils.h" #include #include "gc/GCEnum.h" -#include "gc/Zone.h" #include "gc/ZoneAllocator.h" #include "js/friend/ErrorMessages.h" // js::GetErrorMessage, JSMSG_INTERNAL_INTL_ERROR #include "js/Value.h" @@ -24,8 +22,9 @@ #include "vm/JSObject.h" #include "vm/SelfHosting.h" #include "vm/Stack.h" +#include "vm/StringType.h" -#include "vm/JSObject-inl.h" +#include "gc/GCContext-inl.h" bool js::intl::InitializeObject(JSContext* cx, JS::Handle obj, JS::Handle initializer, diff --git a/js/src/builtin/intl/CommonFunctions.h b/js/src/builtin/intl/CommonFunctions.h index f3882cad9c24..ac75d6168810 100644 --- a/js/src/builtin/intl/CommonFunctions.h +++ b/js/src/builtin/intl/CommonFunctions.h @@ -7,16 +7,12 @@ #ifndef builtin_intl_CommonFunctions_h #define builtin_intl_CommonFunctions_h -#include "mozilla/Assertions.h" - #include #include #include -#include #include "js/RootingAPI.h" -#include "js/Vector.h" -#include "vm/StringType.h" +#include "js/Utility.h" namespace mozilla::intl { enum class ICUError : uint8_t; @@ -24,6 +20,8 @@ enum class ICUError : uint8_t; namespace js { +class PropertyName; + namespace intl { /** @@ -93,7 +91,7 @@ struct OldStyleLanguageTagMapping { extern const OldStyleLanguageTagMapping oldStyleLanguageTagMappings[5]; -extern UniqueChars EncodeLocale(JSContext* cx, JSString* locale); +extern JS::UniqueChars EncodeLocale(JSContext* cx, JSString* locale); // The inline capacity we use for a Vector. Use this to ensure that // our uses of ICU string functions, below and elsewhere, will try to fill the diff --git a/js/src/builtin/intl/DateTimeFormat.cpp b/js/src/builtin/intl/DateTimeFormat.cpp index 91c4338edb7c..bb5f259b9afb 100644 --- a/js/src/builtin/intl/DateTimeFormat.cpp +++ b/js/src/builtin/intl/DateTimeFormat.cpp @@ -9,12 +9,10 @@ #include "builtin/intl/DateTimeFormat.h" #include "mozilla/Assertions.h" -#include "mozilla/EnumSet.h" #include "mozilla/intl/Calendar.h" #include "mozilla/intl/DateIntervalFormat.h" #include "mozilla/intl/DateTimeFormat.h" #include "mozilla/intl/DateTimePart.h" -#include "mozilla/intl/DateTimePatternGenerator.h" #include "mozilla/intl/Locale.h" #include "mozilla/intl/TimeZone.h" #include "mozilla/Range.h" @@ -25,9 +23,7 @@ #include "builtin/intl/FormatBuffer.h" #include "builtin/intl/LanguageTag.h" #include "builtin/intl/SharedIntlData.h" -#include "builtin/intl/TimeZoneDataGenerated.h" #include "gc/GCContext.h" -#include "js/CharacterEncoding.h" #include "js/Date.h" #include "js/experimental/Intl.h" // JS::AddMozDateTimeFormatConstructor #include "js/friend/ErrorMessages.h" // js::GetErrorMessage, JSMSG_* diff --git a/js/src/builtin/intl/DateTimeFormat.h b/js/src/builtin/intl/DateTimeFormat.h index ceb95a61bca5..cd93af56c6e7 100644 --- a/js/src/builtin/intl/DateTimeFormat.h +++ b/js/src/builtin/intl/DateTimeFormat.h @@ -7,10 +7,8 @@ #ifndef builtin_intl_DateTimeFormat_h #define builtin_intl_DateTimeFormat_h -#include "builtin/intl/CommonFunctions.h" #include "builtin/SelfHostingDefines.h" #include "js/Class.h" -#include "js/RootingAPI.h" #include "vm/NativeObject.h" namespace mozilla::intl { diff --git a/js/src/builtin/intl/DisplayNames.cpp b/js/src/builtin/intl/DisplayNames.cpp index d082d5a72073..2ddffe03650a 100644 --- a/js/src/builtin/intl/DisplayNames.cpp +++ b/js/src/builtin/intl/DisplayNames.cpp @@ -12,42 +12,33 @@ #include "mozilla/intl/DisplayNames.h" #include "mozilla/PodOperations.h" #include "mozilla/Span.h" -#include "mozilla/TextUtils.h" #include -#include -#include #include "jsnum.h" #include "jspubtd.h" #include "builtin/intl/CommonFunctions.h" #include "builtin/intl/FormatBuffer.h" -#include "builtin/intl/StringAsciiChars.h" -#include "builtin/String.h" #include "gc/AllocKind.h" #include "gc/GCContext.h" #include "js/CallArgs.h" #include "js/Class.h" #include "js/experimental/Intl.h" // JS::AddMozDisplayNamesConstructor #include "js/friend/ErrorMessages.h" // js::GetErrorMessage, JSMSG_* -#include "js/GCVector.h" -#include "js/PropertyAndElement.h" // JS_DefineFunctions, JS_DefineProperties +#include "js/PropertyAndElement.h" // JS_DefineFunctions, JS_DefineProperties #include "js/PropertyDescriptor.h" #include "js/PropertySpec.h" -#include "js/Result.h" #include "js/RootingAPI.h" #include "js/TypeDecls.h" #include "js/Utility.h" #include "vm/GlobalObject.h" -#include "vm/JSAtom.h" #include "vm/JSContext.h" #include "vm/JSObject.h" #include "vm/Printer.h" #include "vm/Runtime.h" #include "vm/SelfHosting.h" #include "vm/Stack.h" -#include "vm/StaticStrings.h" #include "vm/StringType.h" #include "vm/WellKnownAtom.h" // js_*_str diff --git a/js/src/builtin/intl/DisplayNames.h b/js/src/builtin/intl/DisplayNames.h index b4f247b02903..9fd6c63a6284 100644 --- a/js/src/builtin/intl/DisplayNames.h +++ b/js/src/builtin/intl/DisplayNames.h @@ -17,8 +17,6 @@ #include "js/Class.h" // JSClass, JSClassOps, js::ClassSpec #include "js/TypeDecls.h" #include "js/Value.h" -#include "vm/JSObject.h" -#include "vm/List.h" #include "vm/NativeObject.h" struct JS_PUBLIC_API JSContext; diff --git a/js/src/builtin/intl/IntlObject.cpp b/js/src/builtin/intl/IntlObject.cpp index ddf71dfb8225..19e4f5042081 100644 --- a/js/src/builtin/intl/IntlObject.cpp +++ b/js/src/builtin/intl/IntlObject.cpp @@ -12,6 +12,7 @@ #include "mozilla/intl/Calendar.h" #include "mozilla/intl/Collator.h" #include "mozilla/intl/Currency.h" +#include "mozilla/intl/Locale.h" #include "mozilla/intl/MeasureUnitGenerated.h" #include "mozilla/intl/TimeZone.h" @@ -22,19 +23,12 @@ #include #include "builtin/Array.h" -#include "builtin/intl/Collator.h" #include "builtin/intl/CommonFunctions.h" -#include "builtin/intl/DateTimeFormat.h" #include "builtin/intl/FormatBuffer.h" -#include "builtin/intl/LanguageTag.h" -#include "builtin/intl/NumberFormat.h" #include "builtin/intl/NumberingSystemsGenerated.h" -#include "builtin/intl/PluralRules.h" -#include "builtin/intl/RelativeTimeFormat.h" #include "builtin/intl/SharedIntlData.h" #include "builtin/intl/StringAsciiChars.h" #include "ds/Sort.h" -#include "js/CharacterEncoding.h" #include "js/Class.h" #include "js/friend/ErrorMessages.h" // js::GetErrorMessage, JSMSG_* #include "js/GCAPI.h" @@ -45,7 +39,6 @@ #include "vm/GlobalObject.h" #include "vm/JSAtom.h" #include "vm/JSContext.h" -#include "vm/JSObject.h" #include "vm/PlainObject.h" // js::PlainObject #include "vm/StringType.h" #include "vm/WellKnownAtom.h" // js_*_str diff --git a/js/src/builtin/intl/IntlObject.h b/js/src/builtin/intl/IntlObject.h index 545af6cc0484..5b79f74e922b 100644 --- a/js/src/builtin/intl/IntlObject.h +++ b/js/src/builtin/intl/IntlObject.h @@ -7,7 +7,6 @@ #ifndef builtin_intl_IntlObject_h #define builtin_intl_IntlObject_h -#include "js/RootingAPI.h" #include "js/TypeDecls.h" namespace js { diff --git a/js/src/builtin/intl/LanguageTag.cpp b/js/src/builtin/intl/LanguageTag.cpp index 56a4f67c2d60..3372f5d99a41 100644 --- a/js/src/builtin/intl/LanguageTag.cpp +++ b/js/src/builtin/intl/LanguageTag.cpp @@ -11,8 +11,6 @@ #include "builtin/intl/StringAsciiChars.h" #include "gc/Tracer.h" -#include "js/CharacterEncoding.h" -#include "js/TracingAPI.h" #include "vm/JSContext.h" namespace js { diff --git a/js/src/builtin/intl/LanguageTag.h b/js/src/builtin/intl/LanguageTag.h index e7a91168a31c..e896411e1959 100644 --- a/js/src/builtin/intl/LanguageTag.h +++ b/js/src/builtin/intl/LanguageTag.h @@ -12,12 +12,8 @@ #include "mozilla/intl/Locale.h" #include "mozilla/Span.h" -#include "js/AllocPolicy.h" -#include "js/GCAPI.h" #include "js/Result.h" #include "js/RootingAPI.h" -#include "js/Utility.h" -#include "js/Vector.h" struct JS_PUBLIC_API JSContext; class JSLinearString; diff --git a/js/src/builtin/intl/ListFormat.cpp b/js/src/builtin/intl/ListFormat.cpp index 918887180515..7d11d5acd6af 100644 --- a/js/src/builtin/intl/ListFormat.cpp +++ b/js/src/builtin/intl/ListFormat.cpp @@ -8,7 +8,6 @@ #include "mozilla/Assertions.h" #include "mozilla/intl/ListFormat.h" -#include "mozilla/PodOperations.h" #include @@ -20,9 +19,6 @@ #include "js/Vector.h" #include "vm/JSContext.h" #include "vm/PlainObject.h" // js::PlainObject -#include "vm/Runtime.h" // js::ReportAllocationOverflow -#include "vm/SelfHosting.h" -#include "vm/Stack.h" #include "vm/StringType.h" #include "vm/WellKnownAtom.h" // js_*_str diff --git a/js/src/builtin/intl/ListFormat.h b/js/src/builtin/intl/ListFormat.h index 5547d05b4872..da0daa711b67 100644 --- a/js/src/builtin/intl/ListFormat.h +++ b/js/src/builtin/intl/ListFormat.h @@ -11,7 +11,6 @@ #include "builtin/SelfHostingDefines.h" #include "js/Class.h" -#include "js/RootingAPI.h" #include "js/TypeDecls.h" #include "vm/NativeObject.h" diff --git a/js/src/builtin/intl/Locale.cpp b/js/src/builtin/intl/Locale.cpp index 09ed80bd600c..d508bd0a3463 100644 --- a/js/src/builtin/intl/Locale.cpp +++ b/js/src/builtin/intl/Locale.cpp @@ -10,14 +10,12 @@ #include "mozilla/ArrayUtils.h" #include "mozilla/Assertions.h" -#include "mozilla/Casting.h" #include "mozilla/intl/Locale.h" #include "mozilla/Maybe.h" #include "mozilla/Span.h" #include "mozilla/TextUtils.h" #include -#include #include #include #include @@ -32,7 +30,6 @@ #include "js/friend/ErrorMessages.h" // js::GetErrorMessage, JSMSG_* #include "js/TypeDecls.h" #include "js/Wrapper.h" -#include "util/StringBuffer.h" #include "vm/GlobalObject.h" #include "vm/JSContext.h" #include "vm/PlainObject.h" // js::PlainObject diff --git a/js/src/builtin/intl/Locale.h b/js/src/builtin/intl/Locale.h index d90b2f9282fc..93b618528a54 100644 --- a/js/src/builtin/intl/Locale.h +++ b/js/src/builtin/intl/Locale.h @@ -9,7 +9,6 @@ #include -#include "builtin/SelfHostingDefines.h" #include "js/Class.h" #include "vm/NativeObject.h" diff --git a/js/src/builtin/intl/NumberFormat.cpp b/js/src/builtin/intl/NumberFormat.cpp index eed699302207..21b0db030e3f 100644 --- a/js/src/builtin/intl/NumberFormat.cpp +++ b/js/src/builtin/intl/NumberFormat.cpp @@ -22,8 +22,6 @@ #include "mozilla/UniquePtr.h" #include -#include -#include #include #include #include @@ -36,20 +34,16 @@ #include "builtin/intl/FormatBuffer.h" #include "builtin/intl/LanguageTag.h" #include "builtin/intl/RelativeTimeFormat.h" -#include "ds/Sort.h" #include "gc/GCContext.h" #include "js/CharacterEncoding.h" #include "js/PropertySpec.h" #include "js/RootingAPI.h" #include "js/TypeDecls.h" -#include "js/Vector.h" #include "util/Text.h" #include "vm/BigIntType.h" #include "vm/GlobalObject.h" #include "vm/JSContext.h" #include "vm/PlainObject.h" // js::PlainObject -#include "vm/SelfHosting.h" -#include "vm/Stack.h" #include "vm/StringType.h" #include "vm/WellKnownAtom.h" // js_*_str diff --git a/js/src/builtin/intl/NumberFormat.h b/js/src/builtin/intl/NumberFormat.h index 0055a975b2ca..a0feb4cb4b3a 100644 --- a/js/src/builtin/intl/NumberFormat.h +++ b/js/src/builtin/intl/NumberFormat.h @@ -7,8 +7,6 @@ #ifndef builtin_intl_NumberFormat_h #define builtin_intl_NumberFormat_h -#include "mozilla/Attributes.h" - #include #include "builtin/SelfHostingDefines.h" diff --git a/js/src/builtin/intl/PluralRules.cpp b/js/src/builtin/intl/PluralRules.cpp index 54f38181952a..b7f9d3c6ca06 100644 --- a/js/src/builtin/intl/PluralRules.cpp +++ b/js/src/builtin/intl/PluralRules.cpp @@ -10,13 +10,11 @@ #include "mozilla/Assertions.h" #include "mozilla/Casting.h" -#include "mozilla/intl/NumberFormat.h" #include "mozilla/intl/PluralRules.h" #include "builtin/Array.h" #include "builtin/intl/CommonFunctions.h" #include "gc/GCContext.h" -#include "js/CharacterEncoding.h" #include "js/PropertySpec.h" #include "vm/GlobalObject.h" #include "vm/JSContext.h" diff --git a/js/src/builtin/intl/PluralRules.h b/js/src/builtin/intl/PluralRules.h index 277e0debbfb5..86d8ec105df6 100644 --- a/js/src/builtin/intl/PluralRules.h +++ b/js/src/builtin/intl/PluralRules.h @@ -9,7 +9,6 @@ #include "builtin/SelfHostingDefines.h" #include "js/Class.h" -#include "js/RootingAPI.h" #include "vm/NativeObject.h" namespace mozilla::intl { diff --git a/js/src/builtin/intl/RelativeTimeFormat.cpp b/js/src/builtin/intl/RelativeTimeFormat.cpp index 457aec9857ec..c847fe0e6cb2 100644 --- a/js/src/builtin/intl/RelativeTimeFormat.cpp +++ b/js/src/builtin/intl/RelativeTimeFormat.cpp @@ -16,7 +16,6 @@ #include "builtin/intl/FormatBuffer.h" #include "builtin/intl/LanguageTag.h" #include "gc/GCContext.h" -#include "js/CharacterEncoding.h" #include "js/friend/ErrorMessages.h" // js::GetErrorMessage, JSMSG_* #include "js/PropertySpec.h" #include "vm/GlobalObject.h" diff --git a/js/src/builtin/intl/RelativeTimeFormat.h b/js/src/builtin/intl/RelativeTimeFormat.h index 3f4500f0b70c..f46aaa217bf9 100644 --- a/js/src/builtin/intl/RelativeTimeFormat.h +++ b/js/src/builtin/intl/RelativeTimeFormat.h @@ -15,7 +15,6 @@ #include "gc/Barrier.h" #include "js/Class.h" #include "vm/NativeObject.h" -#include "vm/Runtime.h" namespace mozilla::intl { class RelativeTimeFormat; diff --git a/js/src/builtin/intl/SharedIntlData.cpp b/js/src/builtin/intl/SharedIntlData.cpp index 60ccc8464f98..c3cbffc70e6a 100644 --- a/js/src/builtin/intl/SharedIntlData.cpp +++ b/js/src/builtin/intl/SharedIntlData.cpp @@ -28,9 +28,7 @@ #include "builtin/Array.h" #include "builtin/intl/CommonFunctions.h" -#include "builtin/intl/LanguageTag.h" #include "builtin/intl/TimeZoneDataGenerated.h" -#include "builtin/String.h" #include "js/Utility.h" #include "js/Vector.h" #include "vm/ArrayObject.h" diff --git a/js/src/builtin/intl/SharedIntlData.h b/js/src/builtin/intl/SharedIntlData.h index ba0006348264..8cada7c61bd0 100644 --- a/js/src/builtin/intl/SharedIntlData.h +++ b/js/src/builtin/intl/SharedIntlData.h @@ -13,7 +13,6 @@ #include #include "js/AllocPolicy.h" -#include "js/CharacterEncoding.h" #include "js/GCAPI.h" #include "js/GCHashTable.h" #include "js/Result.h" diff --git a/js/src/builtin/intl/StringAsciiChars.h b/js/src/builtin/intl/StringAsciiChars.h index 64408c68e79a..3323544d8c92 100644 --- a/js/src/builtin/intl/StringAsciiChars.h +++ b/js/src/builtin/intl/StringAsciiChars.h @@ -11,7 +11,6 @@ #include "mozilla/Attributes.h" #include "mozilla/Maybe.h" #include "mozilla/Span.h" -#include "mozilla/TextUtils.h" #include