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

Elizabeth Andrews via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 16 14:10:03 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rGe62b2fc40d11: [NFC][Clang] Fix static analyzer concern (authored by eandrews).
Herald added a project: clang.

Changed prior to commit:
  https://reviews.llvm.org/D157888?vs=549962&id=550886#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D157888

Files:
  clang/lib/StaticAnalyzer/Checkers/FuchsiaHandleChecker.cpp


Index: clang/lib/StaticAnalyzer/Checkers/FuchsiaHandleChecker.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Checkers/FuchsiaHandleChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/FuchsiaHandleChecker.cpp
@@ -653,10 +653,11 @@
   if (Type.isSuppressOnSink()) {
     const ExplodedNode *AcquireNode = getAcquireSite(ErrorNode, Sym, C);
     if (AcquireNode) {
+      const Stmt *S = AcquireNode->getStmtForDiagnostics();
+      assert(S && "Statement cannot be null.");
       PathDiagnosticLocation LocUsedForUniqueing =
           PathDiagnosticLocation::createBegin(
-              AcquireNode->getStmtForDiagnostics(), C.getSourceManager(),
-              AcquireNode->getLocationContext());
+              S, C.getSourceManager(), AcquireNode->getLocationContext());
 
       R = std::make_unique<PathSensitiveBugReport>(
           Type, Msg, ErrorNode, LocUsedForUniqueing,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157888.550886.patch
Type: text/x-patch
Size: 935 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230816/0cf2a8c9/attachment.bin>


More information about the cfe-commits mailing list