@@ -8,67 +8,62 @@ class TypeVisitor : public TypeVisitorBase<TypeVisitor> {
8
8
public:
9
9
using TypeVisitorBase<TypeVisitor>::TypeVisitorBase;
10
10
11
- void visit (swift::TypeBase* type);
12
11
codeql::TypeRepr translateTypeRepr (const swift::TypeRepr& typeRepr, swift::Type type);
13
12
14
- void visitProtocolType (swift::ProtocolType* type);
15
- void visitEnumType (swift::EnumType* type);
16
- void visitStructType (swift::StructType* type);
17
- void visitClassType (swift::ClassType* type);
18
- void visitFunctionType (swift::FunctionType* type);
19
- void visitTupleType (swift::TupleType* type);
20
- void visitBoundGenericEnumType (swift::BoundGenericEnumType* type);
21
- void visitMetatypeType (swift::MetatypeType* type);
22
- void visitExistentialMetatypeType (swift::ExistentialMetatypeType* type);
23
- void visitBoundGenericStructType (swift::BoundGenericStructType* type);
24
- void visitTypeAliasType (swift::TypeAliasType* type);
25
- void visitBuiltinIntegerLiteralType (swift::BuiltinIntegerLiteralType* type);
26
- void visitBuiltinFloatType (swift::BuiltinFloatType* type);
27
- void visitBuiltinIntegerType (swift::BuiltinIntegerType* type);
28
- void visitBoundGenericClassType (swift::BoundGenericClassType* type);
29
- void visitDependentMemberType (swift::DependentMemberType* type);
30
- void visitParenType (swift::ParenType* type);
31
- void visitUnarySyntaxSugarType (swift::UnarySyntaxSugarType* type);
13
+ codeql::ProtocolType translateProtocolType (const swift::ProtocolType& type);
14
+ codeql::EnumType translateEnumType (const swift::EnumType& type);
15
+ codeql::StructType translateStructType (const swift::StructType& type);
16
+ codeql::ClassType translateClassType (const swift::ClassType& type);
17
+ codeql::FunctionType translateFunctionType (const swift::FunctionType& type);
18
+ codeql::TupleType translateTupleType (const swift::TupleType& type);
19
+ codeql::MetatypeType translateMetatypeType (const swift::MetatypeType& type);
20
+ codeql::ExistentialMetatypeType translateExistentialMetatypeType (
21
+ const swift::ExistentialMetatypeType& type);
22
+ codeql::TypeAliasType translateTypeAliasType (const swift::TypeAliasType& type);
23
+ codeql::DependentMemberType translateDependentMemberType (const swift::DependentMemberType& type);
24
+ codeql::ParenType translateParenType (const swift::ParenType& type);
25
+ codeql::UnarySyntaxSugarType translateUnarySyntaxSugarType (
26
+ const swift::UnarySyntaxSugarType& type);
32
27
codeql::OptionalType translateOptionalType (const swift::OptionalType& type);
33
28
codeql::ArraySliceType translateArraySliceType (const swift::ArraySliceType& type);
34
- void visitDictionaryType (swift::DictionaryType* type);
35
- void visitGenericFunctionType (swift::GenericFunctionType* type);
36
- void visitGenericTypeParamType (swift::GenericTypeParamType* type);
37
- void visitLValueType (swift::LValueType* type);
38
- void visitUnboundGenericType (swift::UnboundGenericType* type);
39
- void visitBoundGenericType (swift::BoundGenericType* type);
29
+ codeql::DictionaryType translateDictionaryType (const swift::DictionaryType& type);
30
+ codeql::GenericFunctionType translateGenericFunctionType (const swift::GenericFunctionType& type);
31
+ codeql::GenericTypeParamType translateGenericTypeParamType (
32
+ const swift::GenericTypeParamType& type);
33
+ codeql::LValueType translateLValueType (const swift::LValueType& type);
34
+ codeql::UnboundGenericType translateUnboundGenericType (const swift::UnboundGenericType& type);
35
+
36
+ template <typename Type>
37
+ codeql::TrapClassOf<Type> translateBoundGenericType (const Type& type) {
38
+ auto entry = createTypeEntry (type);
39
+ fillBoundGenericType (type, entry);
40
+ return entry;
41
+ }
42
+
40
43
codeql::PrimaryArchetypeType translatePrimaryArchetypeType (
41
44
const swift::PrimaryArchetypeType& type);
42
45
codeql::ExistentialType translateExistentialType (const swift::ExistentialType& type);
43
46
codeql::DynamicSelfType translateDynamicSelfType (const swift::DynamicSelfType& type);
44
47
codeql::VariadicSequenceType translateVariadicSequenceType (
45
48
const swift::VariadicSequenceType& type);
46
49
codeql::InOutType translateInOutType (const swift::InOutType& type);
47
- codeql::UnmanagedStorageType translateUnmanagedStorageType (
48
- const swift::UnmanagedStorageType& type);
49
- codeql::WeakStorageType translateWeakStorageType (const swift::WeakStorageType& type);
50
- codeql::UnownedStorageType translateUnownedStorageType (const swift::UnownedStorageType& type);
50
+
51
+ template <typename Type>
52
+ codeql::TrapClassOf<Type> translateReferenceStorageType (const Type& type) {
53
+ auto entry = createTypeEntry (type);
54
+ fillReferenceStorageType (type, entry);
55
+ return entry;
56
+ }
57
+
51
58
codeql::ProtocolCompositionType translateProtocolCompositionType (
52
59
const swift::ProtocolCompositionType& type);
53
- codeql::BuiltinIntegerLiteralType translateBuiltinIntegerLiteralType (
54
- const swift::BuiltinIntegerLiteralType& type);
60
+
61
+ template <typename Type>
62
+ codeql::TrapClassOf<Type> translateBuiltinType (const Type& type) {
63
+ return createTypeEntry (type);
64
+ }
65
+
55
66
codeql::BuiltinIntegerType translateBuiltinIntegerType (const swift::BuiltinIntegerType& type);
56
- codeql::BuiltinBridgeObjectType translateBuiltinBridgeObjectType (
57
- const swift::BuiltinBridgeObjectType& type);
58
- codeql::BuiltinDefaultActorStorageType translateBuiltinDefaultActorStorageType (
59
- const swift::BuiltinDefaultActorStorageType& type);
60
- codeql::BuiltinExecutorType translateBuiltinExecutorType (const swift::BuiltinExecutorType& type);
61
- codeql::BuiltinFloatType translateBuiltinFloatType (const swift::BuiltinFloatType& type);
62
- codeql::BuiltinJobType translateBuiltinJobType (const swift::BuiltinJobType& type);
63
- codeql::BuiltinNativeObjectType translateBuiltinNativeObjectType (
64
- const swift::BuiltinNativeObjectType& type);
65
- codeql::BuiltinRawPointerType translateBuiltinRawPointerType (
66
- const swift::BuiltinRawPointerType& type);
67
- codeql::BuiltinRawUnsafeContinuationType translateBuiltinRawUnsafeContinuationType (
68
- const swift::BuiltinRawUnsafeContinuationType& type);
69
- codeql::BuiltinUnsafeValueBufferType translateBuiltinUnsafeValueBufferType (
70
- const swift::BuiltinUnsafeValueBufferType& type);
71
- codeql::BuiltinVectorType translateBuiltinVectorType (const swift::BuiltinVectorType& type);
72
67
codeql::OpenedArchetypeType translateOpenedArchetypeType (const swift::OpenedArchetypeType& type);
73
68
codeql::ModuleType translateModuleType (const swift::ModuleType& type);
74
69
@@ -79,9 +74,9 @@ class TypeVisitor : public TypeVisitorBase<TypeVisitor> {
79
74
codeql::UnarySyntaxSugarType& entry);
80
75
void fillReferenceStorageType (const swift::ReferenceStorageType& type,
81
76
codeql::ReferenceStorageType& entry);
82
- void emitAnyFunctionType (const swift::AnyFunctionType* type, TrapLabel<AnyFunctionTypeTag> label );
83
- void emitBoundGenericType ( swift::BoundGenericType* type, TrapLabel<BoundGenericTypeTag> label );
84
- void emitAnyGenericType ( swift::AnyGenericType* type, TrapLabel<AnyGenericTypeTag> label );
77
+ void fillAnyFunctionType (const swift::AnyFunctionType& type, codeql::AnyFunctionType& entry );
78
+ void fillBoundGenericType ( const swift::BoundGenericType& type, codeql::BoundGenericType& entry );
79
+ void fillAnyGenericType ( const swift::AnyGenericType& type, codeql::AnyGenericType& entry );
85
80
86
81
template <typename T, typename ... Args>
87
82
auto createTypeEntry (const T& type, const Args&... args) {
0 commit comments