Skip to content

Commit

Permalink
Remove superfluous Codegen ctor.
Browse files Browse the repository at this point in the history
  • Loading branch information
1uc committed Nov 5, 2024
1 parent 095fc75 commit 76e05de
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 31 deletions.
28 changes: 0 additions & 28 deletions src/codegen/codegen_cpp_visitor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,34 +236,6 @@ using printer::CodePrinter;
*/
class CodegenCppVisitor: public visitor::ConstAstVisitor {
public:
/**
* \brief Constructs the C++ code generator visitor
*
* This constructor instantiates an NMODL C++ code generator and allows writing generated code
* directly to a file in \c [output_dir]/[mod_filename].cpp.
*
* \note No code generation is performed at this stage. Since the code
* generator classes are all based on \c AstVisitor the AST must be visited using e.g. \c
* visit_program in order to generate the C++ code corresponding to the AST.
*
* \param mod_filename The name of the model for which code should be generated.
* It is used for constructing an output filename.
* \param output_dir The directory where target C++ file should be generated.
* \param float_type The float type to use in the generated code. The string will be used
* as-is in the target code. This defaults to \c double.
*/
CodegenCppVisitor(std::string mod_filename,
const std::string& output_dir,
std::string float_type,
const bool optimize_ionvar_copies,
std::unique_ptr<nmodl::utils::Blame> blame)
: printer(std::make_unique<CodePrinter>(output_dir + "/" + mod_filename + ".cpp",
std::move(blame)))
, mod_filename(std::move(mod_filename))
, float_type(std::move(float_type))
, optimize_ionvar_copies(optimize_ionvar_copies) {}


/**
* \brief Constructs the C++ code generator visitor
*
Expand Down
8 changes: 5 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -600,12 +600,14 @@ int run_nmodl(int argc, const char* argv[]) {
}

{
auto output_stream = std::ofstream(std::filesystem::path(output_dir) /
(modfile + ".cpp"));
auto blame_level = detailed_blame ? utils::BlameLevel::Detailed
: utils::BlameLevel::Short;
if (coreneuron_code && oacc_backend) {
logger->info("Running OpenACC backend code generator for CoreNEURON");
CodegenAccVisitor visitor(modfile,
output_dir,
output_stream,
data_type,
optimize_ionvar_copies_codegen,
utils::make_blame(blame_line, blame_level));
Expand All @@ -615,7 +617,7 @@ int run_nmodl(int argc, const char* argv[]) {
else if (coreneuron_code && !neuron_code && cpp_backend) {
logger->info("Running C++ backend code generator for CoreNEURON");
CodegenCoreneuronCppVisitor visitor(modfile,
output_dir,
output_stream,
data_type,
optimize_ionvar_copies_codegen,
utils::make_blame(blame_line, blame_level));
Expand All @@ -625,7 +627,7 @@ int run_nmodl(int argc, const char* argv[]) {
else if (neuron_code && cpp_backend) {
logger->info("Running C++ backend code generator for NEURON");
CodegenNeuronCppVisitor visitor(modfile,
output_dir,
output_stream,
data_type,
optimize_ionvar_copies_codegen,
utils::make_blame(blame_line, blame_level));
Expand Down

0 comments on commit 76e05de

Please sign in to comment.