[clang] c70dab0 - [NFC][Clang] Fix static analyzer concern about null value dereference

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


Author: Elizabeth Andrews
Date: 2023-08-14T13:07:24-07:00
New Revision: c70dab026d377736c1281d3c8005bb5e578ec8b3

URL: https://github.com/llvm/llvm-project/commit/c70dab026d377736c1281d3c8005bb5e578ec8b3
DIFF: https://github.com/llvm/llvm-project/commit/c70dab026d377736c1281d3c8005bb5e578ec8b3.diff

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

Differential Revision: https://reviews.llvm.org/D157885

Added: 
    

Modified: 
    clang/lib/Serialization/ASTReaderDecl.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp
index c8cbee14be4f02..15e88a9be44ad0 100644
--- a/clang/lib/Serialization/ASTReaderDecl.cpp
+++ b/clang/lib/Serialization/ASTReaderDecl.cpp
@@ -4459,7 +4459,9 @@ void ASTDeclReader::UpdateDecl(Decl *D,
       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


        


More information about the cfe-commits mailing list