Skip to content

Commit

Permalink
[clang-tidy][NFC] Fix llvm-else-after-return findings
Browse files Browse the repository at this point in the history
Fix issues found by clang-tidy in clang-tidy source directory.
  • Loading branch information
PiotrZSL committed Aug 30, 2023
1 parent aea4528 commit 26f230f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 3 additions & 5 deletions clang-tools-extra/clang-tidy/google/AvoidCStyleCastsCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,14 @@ static bool pointedUnqualifiedTypesAreEqual(QualType T1, QualType T2) {
}

static clang::CharSourceRange getReplaceRange(const ExplicitCastExpr *Expr) {
if (const auto *CastExpr = dyn_cast<CStyleCastExpr>(Expr)) {
if (const auto *CastExpr = dyn_cast<CStyleCastExpr>(Expr))
return CharSourceRange::getCharRange(
CastExpr->getLParenLoc(),
CastExpr->getSubExprAsWritten()->getBeginLoc());
}
if (const auto *CastExpr = dyn_cast<CXXFunctionalCastExpr>(Expr)) {
if (const auto *CastExpr = dyn_cast<CXXFunctionalCastExpr>(Expr))
return CharSourceRange::getCharRange(CastExpr->getBeginLoc(),
CastExpr->getLParenLoc());
} else
llvm_unreachable("Unsupported CastExpr");
llvm_unreachable("Unsupported CastExpr");
}

static StringRef getDestTypeString(const SourceManager &SM,
Expand Down
4 changes: 2 additions & 2 deletions clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,8 @@ static std::optional<ContainerCall> getContainerExpr(const Expr *Call) {
return ContainerCall{TheCall->getArg(0),
TheCall->getDirectCallee()->getName(), false,
CallKind};

} else if (const auto *TheCall = dyn_cast_or_null<CallExpr>(Dug)) {
}
if (const auto *TheCall = dyn_cast_or_null<CallExpr>(Dug)) {
if (TheCall->getNumArgs() != 1)
return std::nullopt;

Expand Down

0 comments on commit 26f230f

Please sign in to comment.