Skip to content

Commit

Permalink
Apply suggestions of clang-tidy.
Browse files Browse the repository at this point in the history
  • Loading branch information
PetroZarytskyi committed Jan 14, 2024
1 parent 17d22e6 commit 9d152f6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/Differentiator/MultiplexExternalRMVSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ void MultiplexExternalRMVSource::

void MultiplexExternalRMVSource::
ActBeforeDifferentiatingLoopCondition() {
for (auto source : m_Sources) {
for (auto* source : m_Sources) {
source->ActBeforeDifferentiatingLoopCondition();
}
}
Expand Down
18 changes: 9 additions & 9 deletions lib/Differentiator/ReverseModeVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ Expr* getArraySizeExpr(const ArrayType* AT, ASTContext& context,
/// FIXME: Explain this.
if ((isa<ReturnStmt>(S) || isa<BreakStmt>(S) || isa<ContinueStmt>(S))
&& isa<CompoundStmt>(SDiff.getStmt_dx())) {
auto returnCS = cast<CompoundStmt>(SDiff.getStmt_dx());
auto* returnCS = cast<CompoundStmt>(SDiff.getStmt_dx());
for (auto iter = returnCS->body_rbegin(), E = returnCS->body_rend(); iter!=E; iter++)
addToCurrentBlock(*iter, direction::reverse);
} else {
Expand Down Expand Up @@ -1064,10 +1064,10 @@ Expr* getArraySizeExpr(const ArrayType* AT, ASTContext& context,
const Stmt* init = FS->getInit();
if (m_ExternalSource)
m_ExternalSource->ActBeforeDifferentiatingLoopInitStmt();
StmtDiff initResult = nullptr;
StmtDiff initResult;
if (init) {
initResult = DifferentiateSingleStmt(init);
if (auto initDeclStmt = dyn_cast<DeclStmt>(initResult.getStmt())) {
if (auto* initDeclStmt = dyn_cast<DeclStmt>(initResult.getStmt())) {
auto* VD = cast<VarDecl>(initDeclStmt->getSingleDecl());
Expr* initValue = VD->getInit();
initResult.updateStmt(BuildOp(BO_Assign, BuildDeclRef(VD), initValue));
Expand Down Expand Up @@ -2459,7 +2459,7 @@ Expr* getArraySizeExpr(const ArrayType* AT, ASTContext& context,
direction::reverse);
for (auto& S : RBlock)
addToCurrentBlock(S, direction::reverse);
Ldiff = LCloned;
Ldiff = LCloned;
} else if (opCode == BO_DivAssign) {
auto RDelayed = DelayedGlobalStoreAndRef(R, /*prefix=*/"_t", /*forceNoRecompute=*/true);
StmtDiff& RResult = RDelayed.Result;
Expand Down Expand Up @@ -3037,9 +3037,9 @@ Expr* getArraySizeExpr(const ArrayType* AT, ASTContext& context,
class PlaceholderReplacer : public RecursiveASTVisitor<PlaceholderReplacer> {
public:
const Expr* placeholder;
Expr* newExpr;
Expr* newExpr{nullptr};
PlaceholderReplacer(const Expr* Placeholder)
: placeholder(Placeholder), newExpr(nullptr) {}
: placeholder(Placeholder) {}

bool VisitExpr(Expr *E) {
for (auto iter = E->child_begin(), e = E->child_end();
Expand Down Expand Up @@ -3282,13 +3282,13 @@ Expr* getArraySizeExpr(const ArrayType* AT, ASTContext& context,
}
addToCurrentBlock(condDiff.getStmt_dx(), direction::reverse);
bodyDiff = Visit(body);
if (auto bodyCS = dyn_cast<CompoundStmt>(bodyDiff.getStmt()))
if (auto* bodyCS = dyn_cast<CompoundStmt>(bodyDiff.getStmt()))
for (Stmt* S : bodyCS->body())
addToCurrentBlock(S, direction::forward);
else
addToCurrentBlock(bodyDiff.getStmt(), direction::forward);
if (bodyDiff.getStmt_dx()) {
if (auto bodyDxCS = dyn_cast<CompoundStmt>(bodyDiff.getStmt_dx()))
if (auto* bodyDxCS = dyn_cast<CompoundStmt>(bodyDiff.getStmt_dx()))
for (auto iter = bodyDxCS->body_rbegin(), e = bodyDxCS->body_rend();
iter != e; ++iter)
addToCurrentBlock(*iter, direction::reverse);
Expand Down Expand Up @@ -3316,7 +3316,7 @@ Expr* getArraySizeExpr(const ArrayType* AT, ASTContext& context,
bodyDiff = DifferentiateSingleStmt(body, /*dfdS=*/nullptr);
addToCurrentBlock(bodyDiff.getStmt(), direction::forward);
if (bodyDiff.getStmt_dx()) {
if (auto bodyDxCS = dyn_cast<CompoundStmt>(bodyDiff.getStmt_dx()))
if (auto* bodyDxCS = dyn_cast<CompoundStmt>(bodyDiff.getStmt_dx()))
for (auto iter = bodyDxCS->body_rbegin(), e = bodyDxCS->body_rend();
iter != e; ++iter)
addToCurrentBlock(*iter, direction::reverse);
Expand Down

0 comments on commit 9d152f6

Please sign in to comment.