[PATCH] D157885: [NFC][Clang] Fix static analyzer concern about null value derefence

Elizabeth Andrews via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 14 13:07:51 PDT 2023


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

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D157885

Files:
  clang/lib/Serialization/ASTReaderDecl.cpp


Index: clang/lib/Serialization/ASTReaderDecl.cpp
===================================================================
--- clang/lib/Serialization/ASTReaderDecl.cpp
+++ clang/lib/Serialization/ASTReaderDecl.cpp
@@ -4459,7 +4459,9 @@
       if (auto *VTSD = dyn_cast<VarTemplateSpecializationDecl>(D)) {
         VTSD->setPointOfInstantiation(POI);
       } else if (auto *VD = dyn_cast<VarDecl>(D)) {
-        VD->getMemberSpecializationInfo()->setPointOfInstantiation(POI);
+        MemberSpecializationInfo *MSInfo = VD->getMemberSpecializationInfo();
+        assert(MSInfo && "No member specialization information");
+        MSInfo->setPointOfInstantiation(POI);
       } else {
         auto *FD = cast<FunctionDecl>(D);
         if (auto *FTSInfo = FD->TemplateOrSpecialization


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157885.550061.patch
Type: text/x-patch
Size: 783 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230814/57fd83cd/attachment.bin>


More information about the cfe-commits mailing list