LLVM: include/llvm/ADT/STLForwardCompat.h Source File (original) (raw)

Go to the documentation of this file.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17#ifndef LLVM_ADT_STLFORWARDCOMPAT_H

18#define LLVM_ADT_STLFORWARDCOMPAT_H

19

20#include

21#include <type_traits>

22

23namespace llvm {

24

25

26

27

28

29template

30struct remove_cvref

31{

32 using type = std::remove_cv_t<std::remove_reference_t>;

33};

34

35template

38

39

40

41

42

43

44

45template <typename T, typename Function>

47 -> std::optional<decltype(F(*O))> {

48 if (O)

49 return F(*O);

50 return std::nullopt;

51}

52

53

54

55template <typename T, typename Function>

57 -> std::optional<decltype(F(*std::move(O)))> {

58 if (O)

59 return F(*std::move(O));

60 return std::nullopt;

61}

62

63

64

65template

66[[nodiscard]] constexpr std::underlying_type_t to_underlying(Enum E) {

67 return static_cast<std::underlying_type_t>(E);

68}

69

70}

71

72#endif

static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")

This is an optimization pass for GlobalISel generic memory operations.

auto transformOptional(const std::optional< T > &O, const Function &F) -> std::optional< decltype(F(*O))>

constexpr std::underlying_type_t< Enum > to_underlying(Enum E)

Returns underlying integer value of an enum.

std::remove_cv_t< std::remove_reference_t< T > > type