LLVM 24.0.0git
BoolOrDefault.h
Go to the documentation of this file.
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_ADT_BOOLORDEFAULT_H
10#define LLVM_ADT_BOOLORDEFAULT_H
11
12#include <cstdint>
13#include <optional>
14
15namespace llvm {
16
17// A bool, or Default when the caller's default applies. Unlike
18// std::optional<bool>, it does not convert to bool.
20
21// Like std::optional<bool>::value_or.
22constexpr bool valueOr(BoolOrDefault X, bool Default) {
24}
25
26constexpr std::optional<bool> toOptional(BoolOrDefault X) {
28 return std::nullopt;
29 return X == BoolOrDefault::True;
30}
31
32} // namespace llvm
33
34#endif // LLVM_ADT_BOOLORDEFAULT_H
#define X(NUM, ENUM, NAME)
Definition ELF.h:665
This is an optimization pass for GlobalISel generic memory operations.
constexpr std::optional< bool > toOptional(BoolOrDefault X)
constexpr bool valueOr(BoolOrDefault X, bool Default)