Author: Simon Pilgrim
Date: 2020-03-12T14:56:50Z
New Revision: 5f9fcfb29e4e30932909ce648ad556a3890e6dce

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

LOG: Replace getAs with castAs to fix null dereference static analyzer warnings.

Use castAs as we know the cast should succeed (and castAs will assert if it 
doesn't) and we're dereferencing it directly in the canAssignObjCInterfaces 
call.

Added: 
    

Modified: 
    clang/lib/AST/ASTContext.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index e50d1d608397..436880968b1f 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -8698,8 +8698,8 @@ bool ASTContext::areComparableObjCPointerTypes(QualType 
LHS, QualType RHS) {
 
 bool ASTContext::canBindObjCObjectType(QualType To, QualType From) {
   return canAssignObjCInterfaces(
-                getObjCObjectPointerType(To)->getAs<ObjCObjectPointerType>(),
-                
getObjCObjectPointerType(From)->getAs<ObjCObjectPointerType>());
+      getObjCObjectPointerType(To)->castAs<ObjCObjectPointerType>(),
+      getObjCObjectPointerType(From)->castAs<ObjCObjectPointerType>());
 }
 
 /// typesAreCompatible - C99 6.7.3p9: For two qualified types to be compatible,


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to