Skip to content

Commit

Permalink
[clang-tidy] Do not use else after return and use auto*.
Browse files Browse the repository at this point in the history
  • Loading branch information
vgvassilev committed Nov 20, 2023
1 parent d5b9b66 commit c9f030a
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions include/clad/Differentiator/ReverseModeVisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,7 @@ namespace clad {
return m_Blocks.back();
else if (d == direction::reverse)
return m_Reverse.back();
else
return m_EssentialReverse.back();
return m_EssentialReverse.back();
}
/// Create new block.
Stmts& beginBlock(direction d = direction::forward) {
Expand All @@ -156,19 +155,18 @@ namespace clad {
/// Remove the block from the stack, wrap it in CompoundStmt and return it.
clang::CompoundStmt* endBlock(direction d = direction::forward) {
if (d == direction::forward) {
auto CS = MakeCompoundStmt(getCurrentBlock(direction::forward));
auto* CS = MakeCompoundStmt(getCurrentBlock(direction::forward));
m_Blocks.pop_back();
return CS;
} else if (d == direction::reverse) {
auto CS = MakeCompoundStmt(getCurrentBlock(direction::reverse));
auto* CS = MakeCompoundStmt(getCurrentBlock(direction::reverse));
std::reverse(CS->body_begin(), CS->body_end());
m_Reverse.pop_back();
return CS;
} else {
auto CS = MakeCompoundStmt(getCurrentBlock(d));
m_EssentialReverse.pop_back();
return CS;
}
auto* CS = MakeCompoundStmt(getCurrentBlock(d));
m_EssentialReverse.pop_back();
return CS;

Check warning on line 169 in include/clad/Differentiator/ReverseModeVisitor.h

View check run for this annotation

Codecov / codecov/patch

include/clad/Differentiator/ReverseModeVisitor.h#L167-L169

Added lines #L167 - L169 were not covered by tests
}

Stmts EndBlockWithoutCreatingCS(direction d = direction::forward) {
Expand Down

0 comments on commit c9f030a

Please sign in to comment.