| 262 | } |
| 263 | |
| 264 | std::string cpp_generator::create_function(const cpp_generator::function& f) |
| 265 | { |
| 266 | impl->function_count++; |
| 267 | if(not f.tparams.empty()) |
| 268 | impl->fs << "template<" << join_strings(f.tparams, ", ") << ">\n"; |
| 269 | std::string name = f.name.empty() ? "f" + std::to_string(impl->function_count) : f.name; |
| 270 | impl->fs << join_strings(f.attributes, " ") << " " << f.return_type << " " << name; |
| 271 | char delim = '('; |
| 272 | if(f.params.empty()) |
| 273 | impl->fs << delim; |
| 274 | for(auto&& p : f.params) |
| 275 | { |
| 276 | impl->fs << delim << p.type << " " << to_c_id(p.name); |
| 277 | delim = ','; |
| 278 | } |
| 279 | impl->fs << ") {\n" << f.body << "\n}\n"; |
| 280 | return name; |
| 281 | } |
| 282 | |
| 283 | } // namespace MIGRAPHX_INLINE_NS |
| 284 | } // namespace migraphx |
no test coverage detected