Author: Simon Pilgrim
Date: 2020-01-13T15:07:56Z
New Revision: 40311f9724953541ab7b755fb6a96b31c1e63f00

URL: 
https://github.com/llvm/llvm-project/commit/40311f9724953541ab7b755fb6a96b31c1e63f00
DIFF: 
https://github.com/llvm/llvm-project/commit/40311f9724953541ab7b755fb6a96b31c1e63f00.diff

LOG: 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.

Added: 
    

Modified: 
    clang/lib/AST/ASTContext.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index d26e7f789d0a..0b2d8b4d1e23 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<FunctionType>();
-  const auto *rbase = rhs->getAs<FunctionType>();
+  const auto *lbase = lhs->castAs<FunctionType>();
+  const auto *rbase = rhs->castAs<FunctionType>();
   const auto *lproto = dyn_cast<FunctionProtoType>(lbase);
   const auto *rproto = dyn_cast<FunctionProtoType>(rbase);
   bool allLTypes = true;


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

Reply via email to