LLVM
24.0.0git
include
llvm
ADT
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
14
namespace
llvm
{
15
16
// A bool, or Default when the caller's default applies. Unlike
17
// std::optional<bool>, it does not convert to bool.
18
enum class
BoolOrDefault
:
uint8_t
{
Default
,
False
,
True
};
19
20
// Like std::optional<bool>::value_or.
21
constexpr
bool
valueOr
(
BoolOrDefault
X
,
bool
Default
) {
22
return
X
==
BoolOrDefault::Default
?
Default
:
X
==
BoolOrDefault::True
;
23
}
24
25
}
// namespace llvm
26
27
#endif
// LLVM_ADT_BOOLORDEFAULT_H
X
#define X(NUM, ENUM, NAME)
Definition
ELF.h:857
uint8_t
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition
DefaultTargetInfo.h:21
llvm::BoolOrDefault
BoolOrDefault
Definition
BoolOrDefault.h:18
llvm::BoolOrDefault::Default
@ Default
Definition
BoolOrDefault.h:18
llvm::BoolOrDefault::True
@ True
Definition
BoolOrDefault.h:18
llvm::BoolOrDefault::False
@ False
Definition
BoolOrDefault.h:18
llvm::valueOr
constexpr bool valueOr(BoolOrDefault X, bool Default)
Definition
BoolOrDefault.h:21
Generated on
for LLVM by
1.14.0