clang: include/clang/CodeGen/ConstantInitFuture.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17#ifndef LLVM_CLANG_CODEGEN_CONSTANTINITFUTURE_H

18#define LLVM_CLANG_CODEGEN_CONSTANTINITFUTURE_H

19

20#include "llvm/ADT/PointerUnion.h"

21#include "llvm/IR/Constant.h"

22

23

24

25

27namespace CodeGen {

28class ConstantInitBuilderBase;

29}

30}

31namespace llvm {

32template <>

35

38 static constexpr int NumLowBitsAvailable = 2;

39};

40}

41

43namespace CodeGen {

44

45

46

48 using PairTy = llvm::PointerUnion<ConstantInitBuilderBase*, llvm::Constant*>;

49

50 PairTy Data;

51

54

55public:

57

58

60 assert(initializer && "creating null future");

61 }

62

63

65

66

67 llvm::Type *getType() const;

68

69

71

72

73

75

79 result.Data = PairTy::getFromOpaqueValue(value);

80 return result;

81 }

84};

85

86}

87}

88

89namespace llvm {

90

91template <>

94

97 }

99 return T::getFromOpaqueValue(p);

100 }

101 static constexpr int NumLowBitsAvailable = T::NumLowBitsAvailable;

102};

103

104}

105

106#endif

A convenience builder class for complex constant initializers, especially for anonymous global struct...

A "future" for a completed constant initializer, which can be passed around independently of any sub-...

llvm::Type * getType() const

Return the type of the initializer.

static constexpr int NumLowBitsAvailable

static ConstantInitFuture getFromOpaqueValue(void *value)

void abandon()

Abandon this initializer.

ConstantInitFuture(llvm::Constant *initializer)

A future can be explicitly created from a fixed initializer.

void installInGlobal(llvm::GlobalVariable *global)

Install the initializer into a global variable.

void * getOpaqueValue() const

The JSON file list parser is used to communicate input to InstallAPI.

Diagnostic wrappers for TextAPI types for error reporting.

static T getFromVoidPointer(void *p)

static void * getAsVoidPointer(T p)

static void * getAsVoidPointer(T future)

static T getFromVoidPointer(void *p)