[clang] 421c9bb - [NFC][Clang] Fix static analyzer concern

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


Author: Elizabeth Andrews
Date: 2023-08-14T07:14:32-07:00
New Revision: 421c9bbf65b78e3410415cac2edf4e00bd4d38ca

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

LOG: [NFC][Clang] Fix static analyzer concern

Fix static analyzer concern about null value
dereference. InterfacePointerType is dereferenced
and should not be null.

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

Added: 
    

Modified: 
    clang/lib/CodeGen/CGObjC.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp
index 46c37eaea82b1a..6c594b5db4bca1 100644
--- a/clang/lib/CodeGen/CGObjC.cpp
+++ b/clang/lib/CodeGen/CGObjC.cpp
@@ -222,6 +222,7 @@ llvm::Value *CodeGenFunction::EmitObjCCollectionLiteral(const Expr *E,
   QualType ResultType = E->getType();
   const ObjCObjectPointerType *InterfacePointerType
     = ResultType->getAsObjCInterfacePointerType();
+  assert(InterfacePointerType && "Unexpected InterfacePointerType - null");
   ObjCInterfaceDecl *Class
     = InterfacePointerType->getObjectType()->getInterface();
   CGObjCRuntime &Runtime = CGM.getObjCRuntime();


        


More information about the cfe-commits mailing list