Skip to content

Commit f34de0a

Browse files
authored
[clang-tidy] [NFC] Potential dereference of nullptr. (#143145)
The static analyzer we use internally complains about potential dereference of `nullptr` for `Found`. I think both `Found` and `Member` can't be null here (please confirm). I have added assertions.
1 parent c995c50 commit f34de0a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ void MisleadingSetterOfReferenceCheck::check(
5050
const MatchFinder::MatchResult &Result) {
5151
const auto *Found = Result.Nodes.getNodeAs<CXXMethodDecl>("bad-set-function");
5252
const auto *Member = Result.Nodes.getNodeAs<FieldDecl>("member");
53+
assert(Found != nullptr);
54+
assert(Member != nullptr);
5355

5456
diag(Found->getBeginLoc(),
5557
"function '%0' can be mistakenly used in order to change the "

0 commit comments

Comments
 (0)