MLLIF
a MLIR-based Language to Language Interoperability Flyover
Loading...
Searching...
No Matches
BridgeGen.h
Go to the documentation of this file.
1/*
2 * Copyright 2025 Yeong-won Seo
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#pragma once
18
19#include "Decl.h"
20
21#include <ostream>
22
23namespace mllif {
24 class Decl;
25 class AssemblyDecl;
26 class NamespaceDecl;
27 class ObjectDecl;
28 class MethodDecl;
29 class FunctionDecl;
30 class ParamDecl;
31}
32
33namespace mllif {
34
35 class BridgeGen {
36 public:
37 virtual ~BridgeGen() = default;
38
39#define MLLIF_GEN_HANDLER(type,...) virtual bool handle##type##__VA_ARGS__ (MLLIFContext& context, const type##Decl &node, std::ostream& out, std::size_t indent)
40
41 MLLIF_GEN_HANDLER(Assembly, Begin) = 0;
42 MLLIF_GEN_HANDLER(Assembly, End) = 0;
43 MLLIF_GEN_HANDLER(Namespace, Begin) = 0;
44 MLLIF_GEN_HANDLER(Namespace, End) = 0;
45 MLLIF_GEN_HANDLER(Object, Begin) = 0;
46 MLLIF_GEN_HANDLER(Object, End) = 0;
47 MLLIF_GEN_HANDLER(Function, Begin) = 0;
48 MLLIF_GEN_HANDLER(Function, End) = 0;
49 MLLIF_GEN_HANDLER(Method, Begin) = 0;
50 MLLIF_GEN_HANDLER(Method, End) { return handleFunctionEnd(context, node, out, indent); }
52
53 virtual void writeParamDelimiter(std::ostream& os) = 0;
54
55#undef MLLIF_GEN_HANDLER
56
57 bool handleDecl(MLLIFContext& context, const std::shared_ptr<Decl> &node, std::ostream& out, std::size_t indent);
58 };
59
60}
MLLIF_GEN_HANDLER(Method, End)
Definition BridgeGen.h:50
MLLIF_GEN_HANDLER(Namespace, End)=0
MLLIF_GEN_HANDLER(Param)=0
MLLIF_GEN_HANDLER(Namespace, Begin)=0
MLLIF_GEN_HANDLER(Function, End)=0
MLLIF_GEN_HANDLER(Assembly, Begin)=0
MLLIF_GEN_HANDLER(Object, Begin)=0
MLLIF_GEN_HANDLER(Method, Begin)=0
bool handleDecl(MLLIFContext &context, const std::shared_ptr< Decl > &node, std::ostream &out, std::size_t indent)
Definition BridgeGen.cxx:20
MLLIF_GEN_HANDLER(Assembly, End)=0
MLLIF_GEN_HANDLER(Function, Begin)=0
virtual void writeParamDelimiter(std::ostream &os)=0
virtual ~BridgeGen()=default
MLLIF_GEN_HANDLER(Object, End)=0