Lines Matching defs:clazz
48 void cpp_generator::set_class_construction_types(isl_class &clazz)
50 for (const auto &cons : clazz.constructors) {
55 if (!is_implicit_conversion(Method(clazz, cons)))
61 clazz.construction_types.emplace(arg_type, param);
71 auto &clazz = kvp.second;
72 set_class_construction_types(clazz);
95 /* Copy the method called "name" described by "fd" from "super" to "clazz"
101 static void copy_method(isl_class &clazz, const isl_class &super,
104 clazz.methods[name].insert(fd);
105 clazz.copied_from.emplace(fd, super);
106 clazz.copy_depth.emplace(fd, depth);
132 /* Return the distance between "clazz" and the ancestor
135 * but appears in "clazz" itself and so the distance is zero.
137 static int copy_depth(const isl_class &clazz, FunctionDecl *fd)
139 if (clazz.copy_depth.count(fd) == 0)
141 return clazz.copy_depth.at(fd);
146 * overridden by a method already in "clazz"?
149 * is a method with the same name in "clazz" that has the same signature and
150 * that comes from an ancestor closer to "clazz",
159 static bool is_overridden(FunctionDecl *fd, isl_class &clazz,
162 if (clazz.methods.count(name) == 0)
165 for (const auto &m : clazz.methods.at(name)) {
168 if (copy_depth(clazz, m) <= depth)
170 clazz.methods[name].erase(m);
176 /* Add the methods "methods" with method name "name" from "super" to "clazz"
177 * provided they have not been overridden by a method already in "clazz".
181 void cpp_generator::copy_methods(isl_class &clazz, const std::string &name,
190 if (is_overridden(fd, clazz, name, depth))
192 copy_method(clazz, super, name, fd, depth);
196 /* Add all methods from "super" to "clazz" that have not been overridden
197 * by a method already in "clazz".
201 void cpp_generator::copy_super_methods(isl_class &clazz, const isl_class &super)
207 copy_methods(clazz, name, super, methods);
211 /* Copy methods from the superclasses of "clazz"
221 void cpp_generator::copy_super_methods(isl_class &clazz, set<string> &done)
223 auto supers = find_superclasses(clazz.type);
228 done.insert(clazz.name);
233 if (super.construction_types.count(clazz.name) == 0)
235 copy_super_methods(clazz, super);
255 auto &clazz = kvp.second;
257 if (clazz.is_type_subclass())
259 if (done.count(clazz.name) != 0)
261 copy_super_methods(clazz, done);
279 for (const auto &cons : clazz.constructors)
280 print_method(Method(clazz, cons));
287 for (const auto &kvp : clazz.methods)
299 for (const auto &set : clazz.set_enums.at(fd)) {
300 EnumMethod method(clazz, fd, set.method_name, set.name);
311 for (const auto &kvp : clazz.set_enums)
378 Method method(clazz, fd, name);
381 if (method.clazz.copied_from.count(method.fd) == 0) {
383 if (clazz.is_get_method(fd))
386 auto super = method.clazz.copied_from.at(method.fd);
415 * that corresponds to a method of "clazz" itself (i.e., that
418 static FunctionDecl *single_local(const isl_class &clazz,
425 if (!clazz.first_arg_matches_class(fn))
444 Method method(clazz, fd, name);
463 * was originally defined in "clazz", then effectively add those variants.
475 local = single_local(clazz, methods);
545 return clazz.is_type_subclass() && generator::is_mutator(clazz, fd);
557 return cpp_generator::type2cpp(method.clazz);
763 /* Translate isl class "clazz" to its corresponding C++ type.
766 string cpp_generator::type2cpp(const isl_class &clazz)
768 return type2cpp(clazz.subclass_name);
909 /* Check if "cons" is an implicit conversion constructor of class "clazz".
917 const auto &clazz = cons.clazz;
925 if (is_isl_type(type) && !is_isl_ctx(type) && is_subclass(type, clazz))
949 /* Get kind of "method" in "clazz".
953 static Method::Kind get_kind(const isl_class &clazz, FunctionDecl *method)
957 else if (generator::is_static(clazz, method))
985 Method::Method(const isl_class &clazz, FunctionDecl *fd,
987 clazz(clazz), fd(fd), name(rename_method(name)),
988 kind(get_kind(clazz, fd)),
999 Method::Method(const isl_class &clazz, FunctionDecl *fd) :
1000 Method(clazz, fd, clazz.method_name(fd))
1214 * Call the generic constructor with method.clazz.name as "this" type,
1219 ConversionMethod(method, method.clazz.name, get_param)
1258 if (clazz.name == this_type) {
1271 EnumMethod::EnumMethod(const isl_class &clazz, FunctionDecl *fd,
1273 Method(clazz, fd, method_name), enum_name(enum_name)
1306 const isl_class &clazz, cpp_generator &generator,
1308 os(os), clazz(clazz), cppstring(type2cpp(clazz)), generator(generator),