|
5 | 5 |
|
6 | 6 | namespace codeql {
|
7 | 7 |
|
| 8 | +namespace detail { |
8 | 9 | // swift code lacks default implementations of visitor for some entities. We can add those here
|
9 |
| -// while we do not have yet all implemented. This is copy and pasted from the corresponding Expr |
| 10 | +// while we do not have yet all implemented. This is a simplified version of the corresponding Expr |
10 | 11 | // code in swift/AST/ASTVisitor.h
|
11 |
| -template <typename ImplClass, typename StmtRetTy = void, typename... Args> |
12 |
| -class PatchedStmtVisitor : public swift::StmtVisitor<ImplClass, StmtRetTy, Args...> { |
| 12 | +template <typename CrtpSubclass> |
| 13 | +class PatchedStmtVisitor : public swift::StmtVisitor<CrtpSubclass> { |
13 | 14 | public:
|
14 |
| -#define ABSTRACT_STMT(CLASS, PARENT) \ |
15 |
| - StmtRetTy visit##CLASS##Stmt(swift::CLASS##Stmt* E, Args... AA) { \ |
16 |
| - return static_cast<ImplClass*>(this)->visit##PARENT(E, ::std::forward<Args>(AA)...); \ |
| 15 | +#define ABSTRACT_STMT(CLASS, PARENT) \ |
| 16 | + void visit##CLASS##Stmt(swift::CLASS##Stmt* E) { \ |
| 17 | + return static_cast<CrtpSubclass*>(this)->visit##PARENT(E); \ |
17 | 18 | }
|
18 | 19 | #define STMT(CLASS, PARENT) ABSTRACT_STMT(CLASS, PARENT)
|
19 | 20 | #include "swift/AST/StmtNodes.def"
|
20 | 21 | };
|
21 | 22 |
|
22 |
| -class StmtVisitor : public PatchedStmtVisitor<StmtVisitor> { |
| 23 | +} // namespace detail |
| 24 | + |
| 25 | +class StmtVisitor : public detail::PatchedStmtVisitor<StmtVisitor> { |
23 | 26 | public:
|
24 | 27 | // SwiftDispatcher should outlive the StmtVisitor
|
25 | 28 | StmtVisitor(SwiftDispatcher& dispatcher) : dispatcher(dispatcher) {}
|
|
0 commit comments