[PATCH] D157888: [NFC][Clang] Fix static analyzer concern about null value dereference

Balázs Benics via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 14 12:18:53 PDT 2023


steakhal added a comment.

Hmm. I guess the assertion is to silence some tool. And I think actually that function might very well also return null in some cases.
Why do you think it cannot or at least should not return null in your context? I couldn't infer this from the context, neither from the description of this patch.

Without that, I would prefer an if to guard the code, instead of asserting this.



================
Comment at: clang/lib/StaticAnalyzer/Checkers/FuchsiaHandleChecker.cpp:657
+      const Stmt *S = AcquireNode->getStmtForDiagnostics();
+      assert(S && "Statmement cannot be null.");
       PathDiagnosticLocation LocUsedForUniqueing =
----------------
I think there is a typo in the word statement.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157888/new/

https://reviews.llvm.org/D157888



More information about the cfe-commits mailing list