[clang] a8648fd - Replace getAs with castAs to fix null dereference static analyzer warning.
Simon Pilgrim via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 5 07:29:11 PST 2020
Author: Simon Pilgrim
Date: 2020-03-05T15:28:54Z
New Revision: a8648fd19aecfe2aed3ce529f488930cc37db4c2
URL: https://github.com/llvm/llvm-project/commit/a8648fd19aecfe2aed3ce529f488930cc37db4c2
DIFF: https://github.com/llvm/llvm-project/commit/a8648fd19aecfe2aed3ce529f488930cc37db4c2.diff
LOG: Replace getAs with castAs to fix null dereference static analyzer warning.
Use castAs as we know the cast should succeed and we're dereferencing in the mangleBareFunctionType call.
Added:
Modified:
clang/lib/AST/ItaniumMangle.cpp
Removed:
################################################################################
diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp
index 5d485e000750..6d21869e2f11 100644
--- a/clang/lib/AST/ItaniumMangle.cpp
+++ b/clang/lib/AST/ItaniumMangle.cpp
@@ -1776,8 +1776,8 @@ void CXXNameMangler::mangleLambda(const CXXRecordDecl *Lambda) {
void CXXNameMangler::mangleLambdaSig(const CXXRecordDecl *Lambda) {
for (auto *D : Lambda->getLambdaExplicitTemplateParameters())
mangleTemplateParamDecl(D);
- const FunctionProtoType *Proto = Lambda->getLambdaTypeInfo()->getType()->
- getAs<FunctionProtoType>();
+ auto *Proto =
+ Lambda->getLambdaTypeInfo()->getType()->castAs<FunctionProtoType>();
mangleBareFunctionType(Proto, /*MangleReturnType=*/false,
Lambda->getLambdaStaticInvoker());
}
More information about the cfe-commits
mailing list