[clang] 40311f9 - Fix "pointer is null" static analyzer warnings. NFCI.
Simon Pilgrim via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 13 07:09:43 PST 2020
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;
More information about the cfe-commits
mailing list