Skip to content

Commit

Permalink
fixup! Fix somes issues spotted by SonarSource
Browse files Browse the repository at this point in the history
  • Loading branch information
tristan0x committed Sep 27, 2023
1 parent a7290e3 commit dde4cc7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions src/codegen/codegen_cpp_visitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,6 @@ std::vector<std::string> CodegenCppVisitor::ion_read_statements(BlockType type)
}
std::vector<std::string> statements;
for (const auto& ion: info.ions) {
const auto& name = ion.name;
for (const auto& var: ion.reads) {
auto const iter = std::find(ion.implicit_reads.begin(), ion.implicit_reads.end(), var);
if (iter != ion.implicit_reads.end()) {
Expand Down Expand Up @@ -587,11 +586,10 @@ std::vector<std::string> CodegenCppVisitor::ion_read_statements_optimized(BlockT
}

// NOLINTNEXTLINE(readability-function-cognitive-complexity)
std::vector<ShadowUseStatement> CodegenCppVisitor::ion_write_statements(BlockType type) {
std::vector<ShadowUseStatement> CodegenCppVisitor::ion_write_statements(BlockType type) const {
std::vector<ShadowUseStatement> statements;
for (const auto& ion: info.ions) {
std::string concentration;
const auto& name = ion.name;
for (const auto& var: ion.writes) {
const auto& variable_names = write_ion_variable_name(var);
if (ion.is_ionic_current(var)) {
Expand Down
2 changes: 1 addition & 1 deletion src/codegen/codegen_cpp_visitor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ class CodegenCppVisitor: public visitor::ConstAstVisitor {
* \param type The type of code block being generated
* \return A \c vector of strings representing the write-back of ion variables
*/
std::vector<ShadowUseStatement> ion_write_statements(BlockType type);
std::vector<ShadowUseStatement> ion_write_statements(BlockType type) const;


/**
Expand Down
2 changes: 1 addition & 1 deletion src/visitors/loop_unroll_visitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ static std::shared_ptr<ast::ExpressionStatement> unroll_for_loop(
}

/// create new statement representing unrolled loop
auto block = new ast::StatementBlock(std::move(statements));
auto block = new ast::StatementBlock(statements);
return std::make_shared<ast::ExpressionStatement>(block);
}

Expand Down

0 comments on commit dde4cc7

Please sign in to comment.