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 authored and PetroZarytskyi committed Nov 20, 2023
1 parent ae5cfb4 commit 8a6b423
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;
}

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

0 comments on commit 8a6b423

Please sign in to comment.