================
@@ -2423,18 +2439,21 @@ class InlinedFunctionCallHandler final : public 
ExpressionHandler {
       if (std::optional<Loc> LValue = RetVal.getAs<Loc>())
         RetVal = State->getSVal(*LValue);
 
-    // See if the return value is NULL. If so, suppress the report.
-    AnalyzerOptions &Options = State->getAnalysisManager().options;
+    bool ReturnsNull = false;
+    if (std::optional<Loc> RetLoc = RetVal.getAs<Loc>())
+      ReturnsNull = State->isNull(*RetLoc).isConstrainedTrue();
 
-    bool EnableNullFPSuppression = false;
-    if (Opts.EnableNullFPSuppression && Options.ShouldSuppressNullReturnPaths)
-      if (std::optional<Loc> RetLoc = RetVal.getAs<Loc>())
-        EnableNullFPSuppression = State->isNull(*RetLoc).isConstrainedTrue();
+    // Keep the tracking permission separate from the decision to suppress the
+    // report: suppress-null-return-paths only governs the latter.
+    AnalyzerOptions &Options = State->getAnalysisManager().options;
+    bool TrackWithFPSuppression = Opts.EnableNullFPSuppression && ReturnsNull;
+    bool NullReturnSuppressesReport =
----------------
benedekaibas wrote:

In order to `NullReturnSuppressesReport` be true it also needs 
`TrackWithFPSuppression` to be true, so they are "bound together" at this 
point. This matches what the old flag has done and based on my thinking it is 
correct. What I think would make this even better is clearing this in the 
comment and in the PR description. I was wondering why you needed 
`TrackWithFPSuppression` to be true for `NullReturnSuppressesReport` when the 
comment here and the PR's description says you separated them.

(It might be the case that it is self-evident for more experienced folks, so if 
other reviewers disagree with my comment you can ignore this.) 



https://github.com/llvm/llvm-project/pull/237901
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to