This is an archive of the discontinued LLVM Phabricator instance.

[Support] Use a custom base class for FormatVariadicTest.cpp (NFC)
ClosedPublic

Authored by kazu on Nov 20 2022, 9:02 AM.

Details

Summary

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

Diff Detail

Event Timeline

kazu created this revision.Nov 20 2022, 9:02 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 20 2022, 9:02 AM
kazu requested review of this revision.Nov 20 2022, 9:02 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 20 2022, 9:02 AM

Please take a look. Thanks!

MaskRay accepted this revision.Nov 21 2022, 10:58 AM
This revision is now accepted and ready to land.Nov 21 2022, 10:58 AM
dblaikie accepted this revision.Nov 21 2022, 11:01 AM

Sounds good, thanks!