[clang] fd8ded9 - Fix "pointer is null" static analyzer warning. NFCI.
Simon Pilgrim via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 10 09:41:52 PST 2020
Author: Simon Pilgrim
Date: 2020-01-10T17:41:26Z
New Revision: fd8ded99fe6e9fcae2c98ccad25d6562c5fa8a14
URL: https://github.com/llvm/llvm-project/commit/fd8ded99fe6e9fcae2c98ccad25d6562c5fa8a14
DIFF: https://github.com/llvm/llvm-project/commit/fd8ded99fe6e9fcae2c98ccad25d6562c5fa8a14.diff
LOG: Fix "pointer is null" static analyzer warning. NFCI.
Use castAs<> instead of getAs<> since the pointer is dereferenced immediately below and castAs will perform the null assertion for us.
Added:
Modified:
clang/lib/CodeGen/CGVTables.cpp
Removed:
################################################################################
diff --git a/clang/lib/CodeGen/CGVTables.cpp b/clang/lib/CodeGen/CGVTables.cpp
index c22504ce2b13..a8dce3c2e859 100644
--- a/clang/lib/CodeGen/CGVTables.cpp
+++ b/clang/lib/CodeGen/CGVTables.cpp
@@ -336,7 +336,7 @@ void CodeGenFunction::EmitCallAndReturnForThunk(llvm::FunctionCallee Callee,
for (const ParmVarDecl *PD : MD->parameters())
EmitDelegateCallArg(CallArgs, PD, SourceLocation());
- const FunctionProtoType *FPT = MD->getType()->getAs<FunctionProtoType>();
+ const FunctionProtoType *FPT = MD->getType()->castAs<FunctionProtoType>();
#ifndef NDEBUG
const CGFunctionInfo &CallFnInfo = CGM.getTypes().arrangeCXXMethodCall(
More information about the cfe-commits
mailing list