Skip to content

Commit

Permalink
Fix Clang-Tidy warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
PetroZarytskyi committed Nov 21, 2023
1 parent 810b485 commit fee07c4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/Differentiator/CladUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ namespace clad {
if (isa<clang::AutoType>(T))
return true;

if (const auto pointerType = dyn_cast<clang::PointerType>(T)) {
if (const auto *const pointerType = dyn_cast<clang::PointerType>(T)) {
return IsAutoOrAutoPtrType(
pointerType->getPointeeType());
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Differentiator/ReverseModeVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1124,7 +1124,7 @@ Expr* getArraySizeExpr(const ArrayType* AT, ASTContext& context,
/// This is a temporary measure to avoid the bug that arises from overwriting
/// local variables on different loop passes.
Expr* forwardCond = cond.getExpr();
if (condVarRes.getExpr() && isa<Expr>(condVarRes.getExpr())) {
if (condVarRes.getExpr() != nullptr && isa<Expr>(condVarRes.getExpr())) {
forwardCond = BuildOp(BO_Comma, cond.getExpr(), cast<Expr>(condVarRes.getExpr()));
}

Expand Down
4 changes: 2 additions & 2 deletions lib/Differentiator/TBRAnalyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,9 @@ TBRAnalyzer::VarData::VarData(const QualType QT) {
} else if (QT->isBuiltinType()) {
type = VarData::FUND_TYPE;
val.m_FundData = false;
} else if (QT->isRecordType()) {
} else if (const auto* recordType = QT->getAs<RecordType>()) {
type = VarData::OBJ_TYPE;
const auto* recordDecl = QT->getAs<RecordType>()->getDecl();
const auto* recordDecl = recordType->getDecl();
auto& newArrMap = val.m_ArrData;
newArrMap = std::unique_ptr<ArrMap>(new ArrMap());
for (const auto* field : recordDecl->fields()) {
Expand Down

0 comments on commit fee07c4

Please sign in to comment.