xref: /llvm-project/polly/lib/External/isl/interface/python.h (revision a749e09e184b2b0b6dde71af01c82dd427b3e3e2)
1 #include <set>
2 #include <clang/AST/Decl.h>
3 #include "generator.h"
4 
5 using namespace std;
6 using namespace clang;
7 
8 class python_generator : public generator {
9 private:
10 	set<string> done;
11 
12 public:
python_generator(SourceManager & SM,set<RecordDecl * > & exported_types,set<FunctionDecl * > exported_functions,set<FunctionDecl * > functions)13 	python_generator(SourceManager &SM, set<RecordDecl *> &exported_types,
14 		set<FunctionDecl *> exported_functions,
15 		set<FunctionDecl *> functions) :
16 		generator(SM, exported_types, exported_functions, functions) {}
17 
18 	virtual void generate();
19 
20 private:
21 	void print(const isl_class &clazz);
22 	void print_method_arguments(int first, int n_arg);
23 	void print_method_header(bool is_static, const string &name, int n_arg);
24 	void print_class_header(const isl_class &clazz, const string &name,
25 		const vector<string> &super);
26 	void print_type_check(int indent, const string &type, const char *fmt,
27 		int pos, bool upcast, const string &super,
28 		const string &name, int n);
29 	void print_type_checks(const string &cname, FunctionDecl *method,
30 		bool first_is_ctx, int n, const vector<string> &super);
31 	void print_copy(QualType type);
32 	void print_callback(ParmVarDecl *param, int arg);
33 	void print_arg_in_call(FunctionDecl *fd, const char *fmt, int arg,
34 		int skip);
35 	void print_argtypes(FunctionDecl *fd);
36 	void print_method_return(int indent, const isl_class &clazz,
37 		FunctionDecl *method, const char *fmt);
38 	void print_restype(FunctionDecl *fd);
39 	void print(map<string, isl_class> &classes, set<string> &done);
40 	void print_constructor(const isl_class &clazz, FunctionDecl *method);
41 	void print_special_constructors(const isl_class &clazz);
42 	void print_special_methods(const isl_class &clazz);
43 	void print_upcast_constructors(const isl_class &clazz);
44 	void print_new(const isl_class &clazz,
45 		const string &python_name);
46 	void print_representation(const isl_class &clazz,
47 		const string &python_name);
48 	void print_copy_callbacks(const isl_class &clazz);
49 	void print_method_type(FunctionDecl *fd);
50 	void print_method_types(const isl_class &clazz);
51 	void print_get_method(const isl_class &clazz, FunctionDecl *fd);
52 	void print_method(const isl_class &clazz, FunctionDecl *method,
53 		vector<string> super);
54 	void print_method_call(int indent, const isl_class &clazz,
55 		FunctionDecl *method, const char *fmt,
56 		int drop_ctx);
57 	void print_argument_checks(const isl_class &clazz, FunctionDecl *fd,
58 		int drop_ctx);
59 	void print_method_overload(const isl_class &clazz,
60 		FunctionDecl *method);
61 	void print_method(const isl_class &clazz, const string &fullname,
62 		const function_set &methods, vector<string> super);
63 	void print_set_enum(const isl_class &clazz, FunctionDecl *fd,
64 		int value, const string &name, const vector<string> &super);
65 	void print_set_enum(const isl_class &clazz, FunctionDecl *fd,
66 		const vector<string> &super);
67 
68 };
69