Author: rksimon Date: Mon Oct 21 11:28:31 2019 New Revision: 375440 URL: http://llvm.org/viewvc/llvm-project?rev=375440&view=rev Log: SemaExceptionSpec - silence static analyzer getAs<> null dereference warnings. NFCI.
The static analyzer is warning about potential null dereferences, but in these cases we should be able to use castAs<> directly and if not assert will fire for us. Modified: cfe/trunk/lib/Sema/SemaExceptionSpec.cpp Modified: cfe/trunk/lib/Sema/SemaExceptionSpec.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExceptionSpec.cpp?rev=375440&r1=375439&r2=375440&view=diff ============================================================================== --- cfe/trunk/lib/Sema/SemaExceptionSpec.cpp (original) +++ cfe/trunk/lib/Sema/SemaExceptionSpec.cpp Mon Oct 21 11:28:31 2019 @@ -263,8 +263,7 @@ static bool hasImplicitExceptionSpec(Fun if (!Decl->getTypeSourceInfo()) return isa<CXXDestructorDecl>(Decl); - const FunctionProtoType *Ty = - Decl->getTypeSourceInfo()->getType()->getAs<FunctionProtoType>(); + auto *Ty = Decl->getTypeSourceInfo()->getType()->castAs<FunctionProtoType>(); return !Ty->hasExceptionSpec(); } @@ -965,9 +964,9 @@ bool Sema::CheckOverridingFunctionExcept PDiag(diag::err_deep_exception_specs_differ), PDiag(diag::note_overridden_virtual_function), PDiag(diag::ext_override_exception_spec), - Old->getType()->getAs<FunctionProtoType>(), + Old->getType()->castAs<FunctionProtoType>(), Old->getLocation(), - New->getType()->getAs<FunctionProtoType>(), + New->getType()->castAs<FunctionProtoType>(), New->getLocation()); } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits