From 03d35ab3ae600b0659dcb47c006d9d51925e427f Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Mon, 21 Oct 2019 18:28:31 +0000 Subject: 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@375440 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaExceptionSpec.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/Sema/SemaExceptionSpec.cpp b/lib/Sema/SemaExceptionSpec.cpp index b334ba568a..c1abf099e9 100644 --- a/lib/Sema/SemaExceptionSpec.cpp +++ b/lib/Sema/SemaExceptionSpec.cpp @@ -263,8 +263,7 @@ static bool hasImplicitExceptionSpec(FunctionDecl *Decl) { if (!Decl->getTypeSourceInfo()) return isa(Decl); - const FunctionProtoType *Ty = - Decl->getTypeSourceInfo()->getType()->getAs(); + auto *Ty = Decl->getTypeSourceInfo()->getType()->castAs(); return !Ty->hasExceptionSpec(); } @@ -965,9 +964,9 @@ bool Sema::CheckOverridingFunctionExceptionSpec(const CXXMethodDecl *New, PDiag(diag::err_deep_exception_specs_differ), PDiag(diag::note_overridden_virtual_function), PDiag(diag::ext_override_exception_spec), - Old->getType()->getAs(), + Old->getType()->castAs(), Old->getLocation(), - New->getType()->getAs(), + New->getType()->castAs(), New->getLocation()); } -- cgit v1.2.1