Skip to content

Commit e767f73

Browse files
committed
[clang-tidy][NFC] Add a few cppcoreguidelines checks to codebase
1 parent 7afeea4 commit e767f73

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

clang-tools-extra/clang-tidy/.clang-tidy

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ Checks: >
99
-bugprone-narrowing-conversions,
1010
-bugprone-unchecked-optional-access,
1111
-bugprone-unused-return-value,
12+
cppcoreguidelines-init-variables,
13+
cppcoreguidelines-missing-std-forward,
14+
cppcoreguidelines-rvalue-reference-param-not-moved,
15+
cppcoreguidelines-virtual-class-destructor,
1216
misc-const-correctness,
1317
modernize-*,
1418
-modernize-avoid-c-arrays,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,8 @@ void UnsafeFunctionsCheck::registerMatchers(MatchFinder *Finder) {
266266
}
267267

268268
void UnsafeFunctionsCheck::check(const MatchFinder::MatchResult &Result) {
269-
const Expr *SourceExpr;
270-
const FunctionDecl *FuncDecl;
269+
const Expr *SourceExpr = nullptr;
270+
const FunctionDecl *FuncDecl = nullptr;
271271

272272
if (const auto *DeclRef = Result.Nodes.getNodeAs<DeclRefExpr>(DeclRefId)) {
273273
SourceExpr = DeclRef;

clang-tools-extra/clang-tidy/utils/UseRangesCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ void UseRangesCheck::check(const MatchFinder::MatchResult &Result) {
199199
if (!NodeStr.consume_front(FuncDecl))
200200
continue;
201201
Function = Value.get<FunctionDecl>();
202-
size_t Index;
202+
size_t Index = 0;
203203
if (NodeStr.getAsInteger(10, Index)) {
204204
llvm_unreachable("Unable to extract replacer index");
205205
}

0 commit comments

Comments
 (0)