File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree 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}}
2929 << { {#get_streamer} }e.{ {field_name} }{ {/get_streamer} }{ {/fields} } << ")";
3030 return out;
3131}
32- { {#id} }
33-
34- template <>
35- struct TagToBindingTrapFunctor<typename { { type} } ::Tag > {
36- using type = {{name} }{ {trap_affix} };
37- };
38- { {/id} }
3932{ {/traps} }
4033}
Original file line number Diff line number Diff line change 11#pragma once
22
3+ // This file implements the mapping needed by the API defined in the TrapTagTraits.h
34#include < swift/AST/ASTVisitor.h>
5+ #include " swift/extractor/trap/TrapTagTraits.h"
46#include " swift/extractor/trap/generated/TrapTags.h"
57
68namespace codeql {
@@ -12,22 +14,22 @@ using SILBoxTypeTag = SilBoxTypeTag;
1214using SILFunctionTypeTag = SilFunctionTypeTag;
1315using SILTokenTypeTag = SilTokenTypeTag;
1416
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; \
1921 }
2022#define MAP_TAG (TYPE ) MAP_TYPE_TO_TAG(TYPE, TYPE##Tag)
2123#define MAP_SUBTAG (TYPE, PARENT ) \
2224 MAP_TAG (TYPE); \
2325 static_assert (std::is_base_of_v<PARENT##Tag, TYPE##Tag>, \
2426 #PARENT " Tag must be a base of " #TYPE " Tag" );
2527
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+ }; \
3133 static_assert (std::is_base_of_v<TYPE##Tag, TAG>, " override is not a subtag" );
3234
3335MAP_TAG (Stmt);
Original file line number Diff line number Diff line change 11#pragma once
22
3+ // This file defines functors that can be specialized to define a mapping from arbitrary types to
4+ // label tags
5+
36#include < type_traits>
47
58namespace codeql {
69
10+ namespace detail {
711template <typename T>
812struct ToTagFunctor ;
913template <typename T>
1014struct ToTagOverride : ToTagFunctor<T> {};
1115
12- template <typename T>
13- using ToTag = typename ToTagOverride<std::remove_const_t <T>>::type;
16+ } // namespace detail
1417
1518template <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;
2020
2121} // namespace codeql
You can’t perform that action at this time.
0 commit comments