diff options
author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2019-10-21 18:28:31 +0000 |
---|---|---|
committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2019-10-21 18:28:31 +0000 |
commit | afb163f53ad567d72757e05c95e4059d3eb8de24 (patch) | |
tree | 5996ee42fbef5c303c1b929fb195abe2650eb239 /clang/lib/Sema/SemaExceptionSpec.cpp | |
parent | 0cfd9e5b580f06d63be7054ba4efa0524011f096 (diff) | |
download | bcm5719-llvm-afb163f53ad567d72757e05c95e4059d3eb8de24.tar.gz bcm5719-llvm-afb163f53ad567d72757e05c95e4059d3eb8de24.zip |
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.
llvm-svn: 375440
Diffstat (limited to 'clang/lib/Sema/SemaExceptionSpec.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExceptionSpec.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaExceptionSpec.cpp b/clang/lib/Sema/SemaExceptionSpec.cpp index b334ba568ad..c1abf099e9f 100644 --- a/clang/lib/Sema/SemaExceptionSpec.cpp +++ b/clang/lib/Sema/SemaExceptionSpec.cpp @@ -263,8 +263,7 @@ static bool hasImplicitExceptionSpec(FunctionDecl *Decl) { 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::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<FunctionProtoType>(), + Old->getType()->castAs<FunctionProtoType>(), Old->getLocation(), - New->getType()->getAs<FunctionProtoType>(), + New->getType()->castAs<FunctionProtoType>(), New->getLocation()); } |