From: Simon Pilgrim Date: Thu, 12 Mar 2020 14:28:16 +0000 (+0000) Subject: Replace getAs with castAs to fix null dereference static analyzer warnings. X-Git-Tag: llvmorg-12-init~12293 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5f9fcfb29e4e30932909ce648ad556a3890e6dce;p=platform%2Fupstream%2Fllvm.git 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. --- 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,