Skip to content

Commit 86802f2

Browse files
committed
[clang-tidy] add .clang-tidy config for clang-tidy project
1 parent 50facad commit 86802f2

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
InheritParentConfig: true
2+
Checks: [
3+
bugprone-*
4+
-bugprone-assignment-in-if-condition,
5+
-bugprone-branch-clone,
6+
-bugprone-easily-swappable-parameters,
7+
-bugprone-narrowing-conversions,
8+
-bugprone-suspicious-stringview-data-usage,
9+
-bugprone-unchecked-optional-access,
10+
-bugprone-unused-return-value,
11+
]

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,10 @@ void CrtpConstructorAccessibilityCheck::check(
129129
<< HintFriend;
130130
}
131131

132-
auto WithFriendHintIfNeeded =
133-
[&](const DiagnosticBuilder &Diag,
134-
bool NeedsFriend) -> const DiagnosticBuilder & {
132+
auto WithFriendHintIfNeeded = [&](const DiagnosticBuilder &Diag,
133+
bool NeedsFriend) {
135134
if (NeedsFriend)
136135
Diag << HintFriend;
137-
138-
return Diag;
139136
};
140137

141138
if (!CRTPDeclaration->hasUserDeclaredConstructor()) {

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -370,16 +370,16 @@ void SizeofExpressionCheck::check(const MatchFinder::MatchResult &Result) {
370370
<< E->getSourceRange();
371371
} else if (Result.Nodes.getNodeAs<Stmt>("loop-expr")) {
372372
auto *SizeofArgTy = Result.Nodes.getNodeAs<Type>("sizeof-arg-type");
373-
if (const auto member = dyn_cast<MemberPointerType>(SizeofArgTy))
374-
SizeofArgTy = member->getPointeeType().getTypePtr();
373+
if (const auto *Member = dyn_cast<MemberPointerType>(SizeofArgTy))
374+
SizeofArgTy = Member->getPointeeType().getTypePtr();
375375

376376
const auto *SzOfExpr = Result.Nodes.getNodeAs<Expr>("sizeof-expr");
377377

378-
if (const auto type = dyn_cast<ArrayType>(SizeofArgTy)) {
378+
if (const auto *Type = dyn_cast<ArrayType>(SizeofArgTy)) {
379379
// check if the array element size is larger than one. If true,
380380
// the size of the array is higher than the number of elements
381-
CharUnits sSize = Ctx.getTypeSizeInChars(type->getElementType());
382-
if (!sSize.isOne()) {
381+
CharUnits SSize = Ctx.getTypeSizeInChars(Type->getElementType());
382+
if (!SSize.isOne()) {
383383
diag(SzOfExpr->getBeginLoc(),
384384
"suspicious usage of 'sizeof' in the loop")
385385
<< SzOfExpr->getSourceRange();

0 commit comments

Comments
 (0)