From: Simon Pilgrim Date: Mon, 13 Jan 2020 14:31:03 +0000 (+0000) Subject: Fix "pointer is null" static analyzer warnings. NFCI. X-Git-Tag: llvmorg-11-init~256 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=40311f9724953541ab7b755fb6a96b31c1e63f00;p=platform%2Fupstream%2Fllvm.git Fix "pointer is null" static analyzer warnings. NFCI. Use castAs<> instead of getAs<> since the pointers are always dereferenced and castAs will perform the null assertion for us. --- diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index d26e7f7..0b2d8b4 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -8707,8 +8707,8 @@ QualType ASTContext::mergeFunctionParameterTypes(QualType lhs, QualType rhs, QualType ASTContext::mergeFunctionTypes(QualType lhs, QualType rhs, bool OfBlockPointer, bool Unqualified) { - const auto *lbase = lhs->getAs(); - const auto *rbase = rhs->getAs(); + const auto *lbase = lhs->castAs(); + const auto *rbase = rhs->castAs(); const auto *lproto = dyn_cast(lbase); const auto *rproto = dyn_cast(rbase); bool allLTypes = true;