Fix "pointer is null" static analyzer warning. NFCI.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Fri, 10 Jan 2020 17:40:34 +0000 (17:40 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Fri, 10 Jan 2020 17:41:26 +0000 (17:41 +0000)
Use castAs<> instead of getAs<> since the pointer is dereferenced immediately below and castAs will perform the null assertion for us.

clang/lib/CodeGen/CGVTables.cpp

index c22504c..a8dce3c 100644 (file)
@@ -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(