File tree Expand file tree Collapse file tree 3 files changed +17
-22
lines changed Expand file tree Collapse file tree 3 files changed +17
-22
lines changed Original file line number Diff line number Diff line change @@ -29,12 +29,5 @@ inline std::ostream &operator<<(std::ostream &out, const {{name}}{{trap_affix}}
29
29
<< { {#get_streamer} }e.{ {field_name} }{ {/get_streamer} }{ {/fields} } << ")";
30
30
return out;
31
31
}
32
- { {#id} }
33
-
34
- template <>
35
- struct TagToBindingTrapFunctor<typename { { type} } ::Tag > {
36
- using type = {{name} }{ {trap_affix} };
37
- };
38
- { {/id} }
39
32
{ {/traps} }
40
33
}
Original file line number Diff line number Diff line change 1
1
#pragma once
2
2
3
+ // This file implements the mapping needed by the API defined in the TrapTagTraits.h
3
4
#include < swift/AST/ASTVisitor.h>
5
+ #include " swift/extractor/trap/TrapTagTraits.h"
4
6
#include " swift/extractor/trap/generated/TrapTags.h"
5
7
6
8
namespace codeql {
@@ -12,22 +14,22 @@ using SILBoxTypeTag = SilBoxTypeTag;
12
14
using SILFunctionTypeTag = SilFunctionTypeTag;
13
15
using SILTokenTypeTag = SilTokenTypeTag;
14
16
15
- #define MAP_TYPE_TO_TAG (TYPE, TAG ) \
16
- template <> \
17
- struct ToTagFunctor <swift::TYPE> { \
18
- using type = TAG; \
17
+ #define MAP_TYPE_TO_TAG (TYPE, TAG ) \
18
+ template <> \
19
+ struct detail :: ToTagFunctor<swift::TYPE> { \
20
+ using type = TAG; \
19
21
}
20
22
#define MAP_TAG (TYPE ) MAP_TYPE_TO_TAG(TYPE, TYPE##Tag)
21
23
#define MAP_SUBTAG (TYPE, PARENT ) \
22
24
MAP_TAG (TYPE); \
23
25
static_assert (std::is_base_of_v<PARENT##Tag, TYPE##Tag>, \
24
26
#PARENT " Tag must be a base of " #TYPE " Tag" );
25
27
26
- #define OVERRIDE_TAG (TYPE, TAG ) \
27
- template <> \
28
- struct ToTagOverride <swift::TYPE> { \
29
- using type = TAG; \
30
- }; \
28
+ #define OVERRIDE_TAG (TYPE, TAG ) \
29
+ template <> \
30
+ struct detail :: ToTagOverride<swift::TYPE> { \
31
+ using type = TAG; \
32
+ }; \
31
33
static_assert (std::is_base_of_v<TYPE##Tag, TAG>, " override is not a subtag" );
32
34
33
35
MAP_TAG (Stmt);
Original file line number Diff line number Diff line change 1
1
#pragma once
2
2
3
+ // This file defines functors that can be specialized to define a mapping from arbitrary types to
4
+ // label tags
5
+
3
6
#include < type_traits>
4
7
5
8
namespace codeql {
6
9
10
+ namespace detail {
7
11
template <typename T>
8
12
struct ToTagFunctor ;
9
13
template <typename T>
10
14
struct ToTagOverride : ToTagFunctor<T> {};
11
15
12
- template <typename T>
13
- using ToTag = typename ToTagOverride<std::remove_const_t <T>>::type;
16
+ } // namespace detail
14
17
15
18
template <typename T>
16
- struct TagToBindingTrapFunctor ;
17
-
18
- template <typename Tag>
19
- using TagToBindingTrap = typename TagToBindingTrapFunctor<Tag>::type;
19
+ using ToTag = typename detail::ToTagOverride<std::remove_const_t <T>>::type;
20
20
21
21
} // namespace codeql
You can’t perform that action at this time.
0 commit comments