From 5f9fcfb29e4e30932909ce648ad556a3890e6dce Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Thu, 12 Mar 2020 14:28:16 +0000 Subject: [PATCH] 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. --- clang/lib/AST/ASTContext.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index e50d1d6..4368809 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(), - getObjCObjectPointerType(From)->getAs()); + getObjCObjectPointerType(To)->castAs(), + getObjCObjectPointerType(From)->castAs()); } /// typesAreCompatible - C99 6.7.3p9: For two qualified types to be compatible, -- 2.7.4