Skip to content

Commit 2e0e01e

Browse files
author
MalavikaSamak
committed
Fixing the format issues.
1 parent 432af1a commit 2e0e01e

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

clang-tools-extra/clang-tidy/bugprone/SizeofExpressionCheck.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ void SizeofExpressionCheck::registerMatchers(MatchFinder *Finder) {
9999

100100
auto LoopExpr =
101101
[](const ast_matchers::internal::Matcher<Stmt> &InnerMatcher) {
102-
return stmt(anyOf(forStmt(InnerMatcher), whileStmt(InnerMatcher), doStmt(InnerMatcher)));
102+
return stmt(anyOf(forStmt(InnerMatcher), whileStmt(InnerMatcher),
103+
doStmt(InnerMatcher)));
103104
};
104105

105106
const auto IntegerExpr = ignoringParenImpCasts(integerLiteral());
@@ -140,10 +141,11 @@ void SizeofExpressionCheck::registerMatchers(MatchFinder *Finder) {
140141
}
141142

142143
if (WarnOnSizeOfInLoopTermination) {
143-
Finder->addMatcher(
144-
LoopExpr(hasDescendant(
145-
binaryOperator(allOf(has(SizeOfExpr.bind("sizeof-expr")), isComparisonOperator()))
146-
)).bind("loop-expr"), this);
144+
Finder->addMatcher(LoopExpr(hasDescendant(binaryOperator(
145+
allOf(has(SizeOfExpr.bind("sizeof-expr")),
146+
isComparisonOperator()))))
147+
.bind("loop-expr"),
148+
this);
147149
}
148150

149151
// Detect sizeof(kPtr) where kPtr is 'const char* kPtr = "abc"';
@@ -373,7 +375,7 @@ void SizeofExpressionCheck::check(const MatchFinder::MatchResult &Result) {
373375
auto *SizeofArgTy = Result.Nodes.getNodeAs<Type>("sizeof-arg-type");
374376
if (const auto member = dyn_cast<MemberPointerType>(SizeofArgTy))
375377
SizeofArgTy = member->getPointeeType().getTypePtr();
376-
378+
377379
auto Loc = Result.Nodes.getNodeAs<Expr>("sizeof-expr");
378380

379381
if (const auto type = dyn_cast<ArrayType>(SizeofArgTy)) {

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,9 @@ Changes in existing checks
220220
to avoid matching usage of functions within the current compilation unit.
221221

222222
- Improved :doc: `bugprone-sizeof-expression
223-
<clang-tidy/checks/bugprone/bugprone-sizeof-expression>` check.
224-
Introduced WarnOnSizeOfInLoopTermination sub-class to detect misuses of sizeof
225-
expression in loop conditions.
223+
<clang-tidy/checks/bugprone/bugprone-sizeof-expression>` check by adding
224+
`WarnOnSizeOfInLoopTermination` option to detect misuses of ``sizeof``
225+
expression in loop conditions.
226226

227227
Removed checks
228228
^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)