Rename {absl => std}::optional in base + everywhere. [Final]
Automated patch. This is a no-op. Please avoid, as much as possible,
assigning unrelated bugs to this.
Context:
https://groups.google.com/a/chromium.org/g/cxx/c/nBD_1LaanTc/m/ghh-ZZhWAwAJ?utm_medium=email
As of https://crrev.com/1204351, absl::optional is now a type alias
for std::optional. We should migrate toward it.
Script:
```
function replace {
echo "Replacing $1 by $2"
git grep -l "$1" \
| cut -f1 -d: \
| grep -v \
-e "components/cast_streaming/browser/public/receiver_config.*" \
-e "components/power_metrics/*" \
-e "components/zucchini/patch_reader.*" \
-e "third_party/abseil-cpp/*" \
-e "third_party/googletest/*" \
-e "third_party/leveldatabase/*" \
-e "third_party/libaddressinput/" \
-e "third_party/liburlpattern/*" \
-e "third_party/lzma_sdk/*" \
-e "third_party/maldoca/*" \
-e "third_party/mediapipe/*" \
-e "third_party/shell-encryption/*"\
-e "third_party/tflite_support/*" \
-e "third_party/webrtc_overrides/*" \
-e "third_party/zxcvbn-cpp/*" \
| grep \
-e "\.h" \
-e "\.cc" \
-e "\.mm" \
-e "\.pidl" \
| sort \
| uniq \
| xargs sed -i "s/$1/$2/g"
}
replace "absl::make_optional" "std::make_optional"
replace "absl::optional" "std::optional"
replace "absl::nullopt" "std::nullopt"
replace "absl::in_place," "std::in_place,"
replace "absl::in_place_t," "std::in_place_t,"
replace "absl::in_place)" "std::in_place)"
replace "absl::in_place_t)" "std::in_place_t)"
replace "\"third_party\/abseil-cpp\/absl\/types\/optional.h\"" "<optional>"
git status
echo "Formatting"
echo "IncludeBlocks: Regroup" >> ".clang-format"
echo "IncludeIsMainRegex: \"(_(android|apple|chromeos|freebsd|fuchsia|fuzzer|ios|linux|mac|nacl|openbsd|posix|stubs?|win))?(_(unit|browser|perf)?tests?)?$\"" >> ".clang-format"
git cl format
git restore ".clang-format"
```
Bug: chromium:1500249
Change-Id: Ic2994b982bbc64d62f030d3d158979dc5d266121
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5296147
Reviewed-by: danakj <[email protected]>
Commit-Queue: danakj <[email protected]>
Owners-Override: danakj <[email protected]>
Auto-Submit: Arthur Sonzogni <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1263362}
diff --git a/base/fuchsia/fidl_event_handler_unittest.cc b/base/fuchsia/fidl_event_handler_unittest.cc
index 3283c981..b3640fc 100644
--- a/base/fuchsia/fidl_event_handler_unittest.cc
+++ b/base/fuchsia/fidl_event_handler_unittest.cc
@@ -60,7 +60,7 @@
constexpr char kLogMessage[] =
"base.testfidl.TestInterface was disconnected with ZX_ERR_PEER_CLOSED";
- absl::optional<fuchsia_logger::LogMessage> logged_message =
+ std::optional<fuchsia_logger::LogMessage> logged_message =
listener_.RunUntilMessageReceived(kLogMessage);
ASSERT_TRUE(logged_message.has_value());
@@ -78,7 +78,7 @@
constexpr char kLogMessage[] =
"test_protocol_name was disconnected with ZX_ERR_PEER_CLOSED";
- absl::optional<fuchsia_logger::LogMessage> logged_message =
+ std::optional<fuchsia_logger::LogMessage> logged_message =
listener_.RunUntilMessageReceived(kLogMessage);
ASSERT_TRUE(logged_message.has_value());
@@ -105,7 +105,7 @@
constexpr char kLogMessage[] =
"base.testfidl.TestInterface was disconnected with ZX_ERR_PEER_CLOSED";
- absl::optional<fuchsia_logger::LogMessage> logged_message =
+ std::optional<fuchsia_logger::LogMessage> logged_message =
listener_.RunUntilMessageReceived(kLogMessage);
ASSERT_TRUE(logged_message.has_value());