clang: include/clang/AST/APNumericStorage.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9#ifndef LLVM_CLANG_AST_APNUMERICSTORAGE_H

10#define LLVM_CLANG_AST_APNUMERICSTORAGE_H

11

12#include "llvm/ADT/APFloat.h"

13#include "llvm/ADT/APInt.h"

14

16class ASTContext;

17

18

19

20

21

22

23

24

25

27 union {

28 uint64_t VAL;

29 uint64_t *pVal;

30 };

31 unsigned BitWidth;

32

33 bool hasAllocation() const { return llvm::APInt::getNumWords(BitWidth) > 1; }

34

37

38protected:

40

42 unsigned NumWords = llvm::APInt::getNumWords(BitWidth);

43 if (NumWords > 1)

44 return llvm::APInt(BitWidth, NumWords, pVal);

45 else

46 return llvm::APInt(BitWidth, VAL);

47 }

49};

50

52public:

56 }

57};

58

60public:

61 llvm::APFloat getValue(const llvm::fltSemantics &Semantics) const {

62 return llvm::APFloat(Semantics, getIntValue());

63 }

66 }

67};

68

69}

70

71#endif

llvm::APFloat getValue(const llvm::fltSemantics &Semantics) const

void setValue(const ASTContext &C, const llvm::APFloat &Val)

void setValue(const ASTContext &C, const llvm::APInt &Val)

llvm::APInt getValue() const

Used by IntegerLiteral/FloatingLiteral/EnumConstantDecl to store the numeric without leaking memory.

uint64_t * pVal

Used to store the >64 bits integer value.

uint64_t VAL

Used to store the <= 64 bits integer value.

llvm::APInt getIntValue() const

void setIntValue(const ASTContext &C, const llvm::APInt &Val)

Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...

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