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

1

2

3

4

5

6

7

8

9

10

11

12

13

14#ifndef LLVM_CLANG_AST_NONTRIVIALTYPEVISITOR_H

15#define LLVM_CLANG_AST_NONTRIVIALTYPEVISITOR_H

16

18

20

22 template <class... Ts> RetTy visit(QualType FT, Ts &&... Args) {

24 std::forward(Args)...);

25 }

26

27 template <class... Ts>

29 Ts &&... Args) {

30 switch (DK) {

32 return asDerived().visitARCStrong(FT, std::forward(Args)...);

34 return asDerived().visitStruct(FT, std::forward(Args)...);

36 return asDerived().visitTrivial(FT, std::forward(Args)...);

38 return asDerived().visitCXXDestructor(FT, std::forward(Args)...);

40 return asDerived().visitARCWeak(FT, std::forward(Args)...);

41 }

42

43 llvm_unreachable("unknown destruction kind");

44 }

45

46 Derived &asDerived() { return static_cast<Derived &>(*this); }

47};

48

49template <class Derived, class RetTy = void>

51 template <class... Ts> RetTy visit(QualType FT, Ts &&... Args) {

54 std::forward(Args)...);

55 }

56

57 template <class... Ts>

60 switch (PDIK) {

62 return asDerived().visitARCStrong(FT, std::forward(Args)...);

64 return asDerived().visitARCWeak(FT, std::forward(Args)...);

66 return asDerived().visitStruct(FT, std::forward(Args)...);

68 return asDerived().visitTrivial(FT, std::forward(Args)...);

69 }

70

71 llvm_unreachable("unknown default-initialize kind");

72 }

73

74 Derived &asDerived() { return static_cast<Derived &>(*this); }

75};

76

77template <class Derived, bool IsMove, class RetTy = void>

79 template <class... Ts> RetTy visit(QualType FT, Ts &&... Args) {

83 return asDerived().visitWithKind(PCK, FT, std::forward(Args)...);

84 }

85

86 template <class... Ts>

88 Ts &&... Args) {

89 asDerived().preVisit(PCK, FT, std::forward(Args)...);

90

91 switch (PCK) {

93 return asDerived().visitARCStrong(FT, std::forward(Args)...);

95 return asDerived().visitARCWeak(FT, std::forward(Args)...);

97 return asDerived().visitStruct(FT, std::forward(Args)...);

99 return asDerived().visitTrivial(FT, std::forward(Args)...);

101 return asDerived().visitVolatileTrivial(FT, std::forward(Args)...);

102 }

103

104 llvm_unreachable("unknown primitive copy kind");

105 }

106

107 Derived &asDerived() { return static_cast<Derived &>(*this); }

108};

109

110}

111

112#endif

C Language Family Type Representation.

A (possibly-)qualified type.

@ DK_objc_strong_lifetime

PrimitiveDefaultInitializeKind

@ PDIK_ARCWeak

The type is an Objective-C retainable pointer type that is qualified with the ARC __weak qualifier.

@ PDIK_Trivial

The type does not fall into any of the following categories.

@ PDIK_ARCStrong

The type is an Objective-C retainable pointer type that is qualified with the ARC __strong qualifier.

@ PDIK_Struct

The type is a struct containing a field whose type is not PCK_Trivial.

PrimitiveCopyKind isNonTrivialToPrimitiveCopy() const

Check if this is a non-trivial type that would cause a C struct transitively containing this type to ...

PrimitiveDefaultInitializeKind isNonTrivialToPrimitiveDefaultInitialize() const

Functions to query basic properties of non-trivial C struct types.

DestructionKind isDestructedType() const

Returns a nonzero value if objects of this type require non-trivial work to clean up after.

PrimitiveCopyKind isNonTrivialToPrimitiveDestructiveMove() const

Check if this is a non-trivial type that would cause a C struct transitively containing this type to ...

@ PCK_Struct

The type is a struct containing a field whose type is neither PCK_Trivial nor PCK_VolatileTrivial.

@ PCK_Trivial

The type does not fall into any of the following categories.

@ PCK_ARCStrong

The type is an Objective-C retainable pointer type that is qualified with the ARC __strong qualifier.

@ PCK_VolatileTrivial

The type would be trivial except that it is volatile-qualified.

@ PCK_ARCWeak

The type is an Objective-C retainable pointer type that is qualified with the ARC __weak qualifier.

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

RetTy visit(QualType FT, Ts &&... Args)

RetTy visitWithKind(QualType::PrimitiveCopyKind PCK, QualType FT, Ts &&... Args)

RetTy visit(QualType FT, Ts &&... Args)

RetTy visitWithKind(QualType::PrimitiveDefaultInitializeKind PDIK, QualType FT, Ts &&... Args)

RetTy visit(QualType FT, Ts &&... Args)

RetTy visitWithKind(QualType::DestructionKind DK, QualType FT, Ts &&... Args)