[all-commits] [llvm/llvm-project] a365f2: [Support] Use a custom base class for FormatVariad...

kazutakahirata via All-commits all-commits at lists.llvm.org
Mon Nov 21 12:22:30 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a365f293dcab9d408b630a525cd6cab0d48df84f
      https://github.com/llvm/llvm-project/commit/a365f293dcab9d408b630a525cd6cab0d48df84f
  Author: Kazu Hirata <kazu at google.com>
  Date:   2022-11-21 (Mon, 21 Nov 2022)

  Changed paths:
    M llvm/unittests/Support/FormatVariadicTest.cpp

  Log Message:
  -----------
  [Support] Use a custom base class for FormatVariadicTest.cpp (NFC)

This patch replaces None with a custom base class in
FormatVariadicTest.cpp.

As part of the migration from llvm::Optional to std::optional, I'd
like to define None as std::nullopt, but FormatVariadicTest.cpp blocks
that.

When you specialize indexed_accessor_range with the base class being
None, the template instantiation eventually generates code to compare
two instances of None.  That's not guaranteed with std::nullopt.

Replacing None with a custom base class allows me to define None as
std::nullopt.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

Differential Revision: https://reviews.llvm.org/D138381




More information about the All-commits mailing list