Skip to content

Commit

Permalink
Put namespace prefix in front of isl classes
Browse files Browse the repository at this point in the history
This is needed to avoid confusion between class `isl::ctx` and function `isl::*::ctx()` (for example `isl::space::ctx()`)
  • Loading branch information
patacca committed Jul 9, 2021
1 parent 6e81fe0 commit b64e33c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
12 changes: 10 additions & 2 deletions interface/noexceptions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1077,7 +1077,7 @@ void cpp_generator::print_method_header(ostream &os, const isl_class &clazz,
FunctionDecl *method, bool is_declaration, function_kind kind)
{
string cname = clazz.base_method_name(method);
string rettype_str = type2cpp(method->getReturnType());
string rettype_str = type2cpp_with_namespace(method->getReturnType());
string classname = type2cpp(clazz);
int num_params = method->getNumParams();
int first_param = 0;
Expand Down Expand Up @@ -1118,7 +1118,7 @@ void cpp_generator::print_method_header(ostream &os, const isl_class &clazz,
for (int i = first_param; i < num_params; ++i) {
ParmVarDecl *param = method->getParamDecl(i);
QualType type = param->getOriginalType();
string cpptype = type2cpp(type);
string cpptype = type2cpp_with_namespace(type);

if (is_callback(type))
num_params--;
Expand Down Expand Up @@ -1430,6 +1430,14 @@ string cpp_generator::type2cpp(QualType type)
die("Cannot convert type to C++ type");
}

string cpp_generator::type2cpp_with_namespace(QualType type)
{
if (is_isl_type(type))
return "isl::" + type2cpp(type->getPointeeType().getAsString());

return type2cpp(type);
}

/* Check if "subclass_type" is a subclass of "class_type".
*/
bool cpp_generator::is_subclass(QualType subclass_type,
Expand Down
1 change: 1 addition & 0 deletions interface/noexceptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class noexceptions_generator : public generator {
std::string rename_method(std::string name);
string type2cpp(const isl_class &clazz);
string type2cpp(QualType type);
string type2cpp_with_namespace(QualType type);
bool is_implicit_conversion(const isl_class &clazz, FunctionDecl *cons);
bool is_subclass(QualType subclass_type, const isl_class &class_type);
function_kind get_method_kind(const isl_class &clazz,
Expand Down

0 comments on commit b64e33c

Please sign in to comment.