Ban abseil variant.h and utility.h libraries
These are just delegating to std now. All usages outside of third_party (plus blink) were migrated to use std directly. https://source.chromium.org/chromium/chromium/src/+/main:third_party/abseil-cpp/absl/types/variant.h;l=33-44;drc=b3defd119a78557e3d5d10f0683c2380b635c67e https://source.chromium.org/chromium/chromium/src/+/main:third_party/abseil-cpp/absl/utility/utility.h;l=35-50;drc=b3defd119a78557e3d5d10f0683c2380b635c67e Bug: 40242126 Change-Id: I9aa978a2477c040f8bd73f77498e14a356a1454d Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6343776 Auto-Submit: Victor Vianna <victorvianna@google.com> Reviewed-by: Peter Kasting <pkasting@chromium.org> Owners-Override: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Cr-Commit-Position: refs/heads/main@{#1434552}
This commit is contained in:

committed by
Victor Vianna

parent
b49bb29e4e
commit
6e84e8d4a0
2
DEPS
2
DEPS
@ -5015,6 +5015,8 @@ include_rules = [
|
||||
'-third_party/abseil-cpp/absl/types/any.h',
|
||||
'-third_party/abseil-cpp/absl/types/optional.h',
|
||||
'-third_party/abseil-cpp/absl/types/span.h',
|
||||
'-third_party/abseil-cpp/absl/types/variant.h',
|
||||
'-third_party/abseil-cpp/absl/utility/utility.h',
|
||||
]
|
||||
|
||||
|
||||
|
21
PRESUBMIT.py
21
PRESUBMIT.py
@ -1065,6 +1065,27 @@ _BANNED_CPP_FUNCTIONS: Sequence[BanRule] = (
|
||||
_THIRD_PARTY_EXCEPT_BLINK # Not an error in third_party folders.
|
||||
],
|
||||
),
|
||||
BanRule(
|
||||
r'/absl::(bad_variant_access|get|holds_alternative|monostate|variant|'
|
||||
r'visit)',
|
||||
('Abseil\'s variant library is banned, use std.', ),
|
||||
# TODO(crbug.com/40242126): Make it an error once we're sure it works.
|
||||
False,
|
||||
[
|
||||
_THIRD_PARTY_EXCEPT_BLINK
|
||||
],
|
||||
),
|
||||
BanRule(
|
||||
r'/absl::(apply|exchange|forward|in_place|index_sequence|'
|
||||
r'integer_sequence|make_from_tuple|make_index_sequence|'
|
||||
r'make_integer_sequence|move)',
|
||||
('Abseil\'s util library is banned, use std.', ),
|
||||
# TODO(crbug.com/40242126): Make it an error once we're sure it works.
|
||||
False,
|
||||
[
|
||||
_THIRD_PARTY_EXCEPT_BLINK
|
||||
],
|
||||
),
|
||||
BanRule(
|
||||
r'/#include <chrono>',
|
||||
('<chrono> is banned. Use base/time instead.', ),
|
||||
|
@ -53,6 +53,8 @@ include_rules = [
|
||||
'-third_party/abseil-cpp/absl/types/any.h',
|
||||
'-third_party/abseil-cpp/absl/types/optional.h',
|
||||
'-third_party/abseil-cpp/absl/types/span.h',
|
||||
'-third_party/abseil-cpp/absl/types/variant.h',
|
||||
'-third_party/abseil-cpp/absl/utility/utility.h',
|
||||
]
|
||||
|
||||
specific_include_rules = {
|
||||
|
@ -34,6 +34,8 @@ include_rules = [
|
||||
'-third_party/abseil-cpp/absl/types/any.h',
|
||||
'-third_party/abseil-cpp/absl/types/optional.h',
|
||||
'-third_party/abseil-cpp/absl/types/span.h',
|
||||
'-third_party/abseil-cpp/absl/types/variant.h',
|
||||
'-third_party/abseil-cpp/absl/utility/utility.h',
|
||||
]
|
||||
|
||||
specific_include_rules = {
|
||||
|
@ -36,6 +36,8 @@ include_rules = [
|
||||
'-third_party/abseil-cpp/absl/types/any.h',
|
||||
'-third_party/abseil-cpp/absl/types/optional.h',
|
||||
'-third_party/abseil-cpp/absl/types/span.h',
|
||||
'-third_party/abseil-cpp/absl/types/variant.h',
|
||||
'-third_party/abseil-cpp/absl/utility/utility.h',
|
||||
]
|
||||
|
||||
specific_include_rules = {
|
||||
|
@ -43,4 +43,6 @@ include_rules = [
|
||||
'-third_party/abseil-cpp/absl/types/any.h',
|
||||
'-third_party/abseil-cpp/absl/types/optional.h',
|
||||
'-third_party/abseil-cpp/absl/types/span.h',
|
||||
'-third_party/abseil-cpp/absl/types/variant.h',
|
||||
'-third_party/abseil-cpp/absl/utility/utility.h',
|
||||
]
|
||||
|
@ -39,6 +39,8 @@ include_rules = [
|
||||
'-third_party/abseil-cpp/absl/types/any.h',
|
||||
'-third_party/abseil-cpp/absl/types/optional.h',
|
||||
'-third_party/abseil-cpp/absl/types/span.h',
|
||||
'-third_party/abseil-cpp/absl/types/variant.h',
|
||||
'-third_party/abseil-cpp/absl/utility/utility.h',
|
||||
]
|
||||
|
||||
specific_include_rules = {
|
||||
|
@ -47,4 +47,6 @@ include_rules = [
|
||||
'-third_party/abseil-cpp/absl/types/any.h',
|
||||
'-third_party/abseil-cpp/absl/types/optional.h',
|
||||
'-third_party/abseil-cpp/absl/types/span.h',
|
||||
'-third_party/abseil-cpp/absl/types/variant.h',
|
||||
'-third_party/abseil-cpp/absl/utility/utility.h',
|
||||
]
|
||||
|
@ -51,4 +51,6 @@ include_rules = [
|
||||
'-third_party/abseil-cpp/absl/types/any.h',
|
||||
'-third_party/abseil-cpp/absl/types/optional.h',
|
||||
'-third_party/abseil-cpp/absl/types/span.h',
|
||||
'-third_party/abseil-cpp/absl/types/variant.h',
|
||||
'-third_party/abseil-cpp/absl/utility/utility.h',
|
||||
]
|
||||
|
@ -37,6 +37,8 @@ include_rules = [
|
||||
'-third_party/abseil-cpp/absl/types/any.h',
|
||||
'-third_party/abseil-cpp/absl/types/optional.h',
|
||||
'-third_party/abseil-cpp/absl/types/span.h',
|
||||
'-third_party/abseil-cpp/absl/types/variant.h',
|
||||
'-third_party/abseil-cpp/absl/utility/utility.h',
|
||||
|
||||
# TODO(crbug.com/402346171): Components should not have dependencies to //ash.
|
||||
# Resolve it.
|
||||
|
@ -35,6 +35,8 @@ include_rules = [
|
||||
'-third_party/abseil-cpp/absl/types/any.h',
|
||||
'-third_party/abseil-cpp/absl/types/optional.h',
|
||||
'-third_party/abseil-cpp/absl/types/span.h',
|
||||
'-third_party/abseil-cpp/absl/types/variant.h',
|
||||
'-third_party/abseil-cpp/absl/utility/utility.h',
|
||||
]
|
||||
|
||||
specific_include_rules = {
|
||||
|
@ -65,6 +65,8 @@ include_rules = [
|
||||
'-third_party/abseil-cpp/absl/types/any.h',
|
||||
'-third_party/abseil-cpp/absl/types/optional.h',
|
||||
'-third_party/abseil-cpp/absl/types/span.h',
|
||||
'-third_party/abseil-cpp/absl/types/variant.h',
|
||||
'-third_party/abseil-cpp/absl/utility/utility.h',
|
||||
]
|
||||
|
||||
specific_include_rules = {
|
||||
|
@ -35,6 +35,8 @@ include_rules = [
|
||||
'-third_party/abseil-cpp/absl/types/any.h',
|
||||
'-third_party/abseil-cpp/absl/types/optional.h',
|
||||
'-third_party/abseil-cpp/absl/types/span.h',
|
||||
'-third_party/abseil-cpp/absl/types/variant.h',
|
||||
'-third_party/abseil-cpp/absl/utility/utility.h',
|
||||
]
|
||||
|
||||
specific_include_rules = {
|
||||
|
@ -45,4 +45,6 @@ include_rules = [
|
||||
'-third_party/abseil-cpp/absl/types/any.h',
|
||||
'-third_party/abseil-cpp/absl/types/optional.h',
|
||||
'-third_party/abseil-cpp/absl/types/span.h',
|
||||
'-third_party/abseil-cpp/absl/types/variant.h',
|
||||
'-third_party/abseil-cpp/absl/utility/utility.h',
|
||||
]
|
||||
|
@ -36,4 +36,6 @@ include_rules = [
|
||||
'-third_party/abseil-cpp/absl/types/any.h',
|
||||
'-third_party/abseil-cpp/absl/types/optional.h',
|
||||
'-third_party/abseil-cpp/absl/types/span.h',
|
||||
'-third_party/abseil-cpp/absl/types/variant.h',
|
||||
'-third_party/abseil-cpp/absl/utility/utility.h',
|
||||
]
|
||||
|
@ -40,4 +40,6 @@ include_rules = [
|
||||
'-third_party/abseil-cpp/absl/types/any.h',
|
||||
'-third_party/abseil-cpp/absl/types/optional.h',
|
||||
'-third_party/abseil-cpp/absl/types/span.h',
|
||||
'-third_party/abseil-cpp/absl/types/variant.h',
|
||||
'-third_party/abseil-cpp/absl/utility/utility.h',
|
||||
]
|
||||
|
@ -2166,3 +2166,55 @@ absolute time and civil time.
|
||||
*** promo
|
||||
Overlaps with `base/time/`.
|
||||
***
|
||||
|
||||
### Variant <sup>[banned]</sup>
|
||||
|
||||
```c++
|
||||
absl::bad_variant_access;
|
||||
absl::get;
|
||||
absl::get_if;
|
||||
absl::holds_alternative;
|
||||
absl::monostate;
|
||||
absl::variant;
|
||||
absl::variant_alternative;
|
||||
absl::variant_alternative_t;
|
||||
absl::variant_npos;
|
||||
absl::variant_size;
|
||||
absl::variant_size_v;
|
||||
absl::visit;
|
||||
```
|
||||
|
||||
**Description:** A backport of C++17's std::variant type-safe union and related utilities.
|
||||
|
||||
**Notes:**
|
||||
*** promo
|
||||
These are just aliases to the std counterparts these days. Use std instead.
|
||||
***
|
||||
|
||||
### Utility library <sup>[banned]</sup>
|
||||
|
||||
```c++
|
||||
absl::apply;
|
||||
absl::exchange;
|
||||
absl::forward;
|
||||
absl::in_place;
|
||||
absl::in_place_index;
|
||||
absl::in_place_index_t;
|
||||
absl::in_place_t;
|
||||
absl::in_place_type;
|
||||
absl::in_place_type_t;
|
||||
absl::index_sequence;
|
||||
absl::index_sequence_for;
|
||||
absl::integer_sequence;
|
||||
absl::make_from_tuple;
|
||||
absl::make_index_sequence;
|
||||
absl::make_integer_sequence;
|
||||
absl::move;
|
||||
```
|
||||
|
||||
**Description:** Backports of various C++17 template utilities.
|
||||
|
||||
**Notes:**
|
||||
*** promo
|
||||
These are just aliases to the std counterparts these days. Use std instead.
|
||||
***
|
||||
|
@ -36,4 +36,6 @@ include_rules = [
|
||||
'-third_party/abseil-cpp/absl/time',
|
||||
'-third_party/abseil-cpp/absl/types/any.h',
|
||||
'-third_party/abseil-cpp/absl/types/span.h',
|
||||
'-third_party/abseil-cpp/absl/types/variant.h',
|
||||
'-third_party/abseil-cpp/absl/utility/utility.h',
|
||||
]
|
||||
|
Reference in New Issue
Block a user