From: Simon Pilgrim Date: Tue, 1 Oct 2019 22:02:46 +0000 (+0000) Subject: CGVTables - silence static analyzer getAs null dereference warning... X-Git-Tag: llvmorg-11-init~7828 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5e0a0b707b1270bb9f80b7cb92f0363a0e0d961f;p=platform%2Fupstream%2Fllvm.git CGVTables - silence static analyzer getAs null dereference warnings. NFCI. The static analyzer is warning about potential null dereferences, but we should be able to use castAs directly and if not assert will fire for us. llvm-svn: 373398 --- diff --git a/clang/lib/CodeGen/CGVTables.cpp b/clang/lib/CodeGen/CGVTables.cpp index 3055ea3..a74905f 100644 --- a/clang/lib/CodeGen/CGVTables.cpp +++ b/clang/lib/CodeGen/CGVTables.cpp @@ -157,7 +157,7 @@ CodeGenFunction::GenerateVarArgsThunk(llvm::Function *Fn, const CGFunctionInfo &FnInfo, GlobalDecl GD, const ThunkInfo &Thunk) { const CXXMethodDecl *MD = cast(GD.getDecl()); - const FunctionProtoType *FPT = MD->getType()->getAs(); + const FunctionProtoType *FPT = MD->getType()->castAs(); QualType ResultType = FPT->getReturnType(); // Get the original function @@ -242,7 +242,6 @@ void CodeGenFunction::StartThunk(llvm::Function *Fn, GlobalDecl GD, // Build FunctionArgs. const CXXMethodDecl *MD = cast(GD.getDecl()); QualType ThisType = MD->getThisType(); - const FunctionProtoType *FPT = MD->getType()->getAs(); QualType ResultType; if (IsUnprototyped) ResultType = CGM.getContext().VoidTy; @@ -251,7 +250,7 @@ void CodeGenFunction::StartThunk(llvm::Function *Fn, GlobalDecl GD, else if (CGM.getCXXABI().hasMostDerivedReturn(GD)) ResultType = CGM.getContext().VoidPtrTy; else - ResultType = FPT->getReturnType(); + ResultType = MD->getType()->castAs()->getReturnType(); FunctionArgList FunctionArgs; // Create the implicit 'this' parameter declaration.