[Support] Use a custom base class for FormatVariadicTest.cpp (NFC)
authorKazu Hirata <kazu@google.com>
Mon, 21 Nov 2022 20:22:16 +0000 (12:22 -0800)
committerKazu Hirata <kazu@google.com>
Mon, 21 Nov 2022 20:22:16 +0000 (12:22 -0800)
commita365f293dcab9d408b630a525cd6cab0d48df84f
tree22ed454a2b44c448782786a4705a4f72f510ed26
parenta59ed8fa86036efe66efcaddd5cd3e1d17856563
[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
llvm/unittests/Support/FormatVariadicTest.cpp