Skip to content

Commit 7ed412a

Browse files
authored
[analyzer] Remove trivially true condition (#152850)
Addresses #83027 (comment) We can only reach this part by a non-null `Ptr`, which also implies a dereference of `PtrExpr`. Consequently, `PtrExpr` cannot be null here so the check is pointless.
1 parent f55281a commit 7ed412a

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

clang/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,7 @@ ProgramStateRef UnixAPIMisuseChecker::EnsurePtrNotNull(
137137
auto R = std::make_unique<PathSensitiveBugReport>(
138138
BT.value_or(std::cref(BT_ArgumentNull)),
139139
(PtrDescr + " pointer might be NULL.").str(), N);
140-
if (PtrExpr)
141-
bugreporter::trackExpressionValue(N, PtrExpr, *R);
140+
bugreporter::trackExpressionValue(N, PtrExpr, *R);
142141
C.emitReport(std::move(R));
143142
}
144143
return nullptr;

0 commit comments

Comments
 (0)