cbor: migrate base or absl optional to std::optional

libchrome base::Optional is replaced by absl::optional on chromium
upstream and removed in r885735.
Since Chrome OS uses c++17, it can also use std::optional (as opposed to
Chrome which uses c++14). See go/use-std-optional-in-cros for

Note, libchrome uses absl::optional because upstream chromium uses C++14
and does not have std::optional. However, absl switched to always use
std::optional implementation in crrev.com/c/2967691 so they are

LSC proposal: go/chromeos-lsc-optional-migration

TEST=FEATURES=test emerge-hatch cbor

Change-Id: I4b152a0306753e95e2e5d325c02e5af34af310b1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/cbor/+/3531333
Tested-by: Grace Cham <hscham@chromium.org>
Reviewed-by: Tom Hughes <tomhughes@chromium.org>
Commit-Queue: Grace Cham <hscham@chromium.org>
7 files changed
tree: e78ee0c6d51aa16c25235b7f6da84258a87c18cc
  1. reader_fuzzer_corpus/
  2. BUILD.gn
  3. cbor_export.h
  4. constants.h
  5. diagnostic_writer.cc
  6. diagnostic_writer.h
  7. diagnostic_writer_unittest.cc
  10. reader.cc
  11. reader.h
  12. reader_fuzzer.cc
  13. reader_unittest.cc
  14. README.md
  15. values.cc
  16. values.h
  17. values_unittest.cc
  18. writer.cc
  19. writer.h
  20. writer_unittest.cc

cbor: Concise Binary Object Representation

This library is a partial implementation of the RFC 7049 Concise Binary Object Representation standard.

The source code was fetched from chromium/src in order to avoid code duplication.

The cros/upstream/main branch is a mirror of the components/cbor directory from upstream. It is automatically updated to reflect the latest changes in upstream.

How to update the source

To pull in updates from chromium/src, do the following:

  • git remote update

  • git checkout -b main cros/main

  • git merge cros/upstream/main

    • Expect merge conflicts, because of the difference in header paths.
    • OWNERS should use the version from main.
    • BUILD.gn should mostly use the version from main, unless the upstream changes the files to be built.
    • The #include paths should use the version from main (without “components/”). This should be the majority of the merge conflicts.
    • In the commit message of the merge, list the commits from upstream that are merged.
    • If you need to do make changes to the merged commits (outside of conflicts), do that work in separate commits. For example, if you need to revert commits, use git revert after committing the merge commit. This preserves the history and makes it clear why a change is being reverted rather than quietly changing it in the merge commit.
    • Check the changes introduced by your merge by doing a diff against the commit before the merge. The difference should be the same as the changes in the upstream.
  • Push the resulting merge commit with:

    (chroot) $ git push HEAD:refs/for/main