This is an archive of the discontinued LLVM Phabricator instance.

Use None consistently (NFC)
ClosedPublic

Authored by kazu on Nov 19 2022, 10:24 PM.

Details

Summary

This patch replaces NoneType() and NoneType::None with None in
preparation for migration from llvm::Optional to std::optional.

In the std::optional world, we are not guranteed to be able to
default-construct std::nullopt_t or peek what's inside it, so neither
NoneType() nor NoneType::None has a corresponding expression in the
std::optional world.

Once we consistently use None, we should even be able to replace the
contents of llvm/include/llvm/ADT/None.h with something like:

using NoneType = std::nullopt_t;
inline constexpr std::nullopt_t None = std::nullopt;

to ease the migration from llvm::Optional to std::optional.

Diff Detail

Event Timeline

kazu created this revision.Nov 19 2022, 10:24 PM
Herald added a reviewer: Amir. · View Herald Transcript
Herald added a reviewer: maksfb. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
kazu requested review of this revision.Nov 19 2022, 10:24 PM
Herald added projects: Restricted Project, Restricted Project, Restricted Project, Restricted Project. · View Herald Transcript
MaskRay accepted this revision.Nov 19 2022, 11:40 PM

LGTM. enum class NoneType { None = 1 }; is from 0cd22f9540c0591132ec991c51103cf800cf4e24 (2017) for MSVC workaround. I assume it is no longer needed..

This revision is now accepted and ready to land.Nov 19 2022, 11:40 PM
This revision was landed with ongoing or failed builds.Nov 20 2022, 12:24 AM
This revision was automatically updated to reflect the committed changes.

Is there an a RFC for this or something?