diff options
author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2019-10-05 13:20:42 +0000 |
---|---|---|
committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2019-10-05 13:20:42 +0000 |
commit | 20692a0d3d3e837e6f81d477cbc07b4eb449d380 (patch) | |
tree | 873e88d55b52cea280abb2812f8daa6b86c67f3b /clang/lib/Sema/SemaStmt.cpp | |
parent | f609c0a303e4e20356d565d2bd4ecec76ed7ca7e (diff) | |
download | bcm5719-llvm-20692a0d3d3e837e6f81d477cbc07b4eb449d380.tar.gz bcm5719-llvm-20692a0d3d3e837e6f81d477cbc07b4eb449d380.zip |
SemaStmt - 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: 373824
Diffstat (limited to 'clang/lib/Sema/SemaStmt.cpp')
-rw-r--r-- | clang/lib/Sema/SemaStmt.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp index bfdc550e755..841801245c5 100644 --- a/clang/lib/Sema/SemaStmt.cpp +++ b/clang/lib/Sema/SemaStmt.cpp @@ -3305,18 +3305,18 @@ Sema::ActOnCapScopeReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) { } assert(!FnRetType.isNull()); - if (BlockScopeInfo *CurBlock = dyn_cast<BlockScopeInfo>(CurCap)) { - if (CurBlock->FunctionType->getAs<FunctionType>()->getNoReturnAttr()) { + if (auto *CurBlock = dyn_cast<BlockScopeInfo>(CurCap)) { + if (CurBlock->FunctionType->castAs<FunctionType>()->getNoReturnAttr()) { Diag(ReturnLoc, diag::err_noreturn_block_has_return_expr); return StmtError(); } - } else if (CapturedRegionScopeInfo *CurRegion = - dyn_cast<CapturedRegionScopeInfo>(CurCap)) { + } else if (auto *CurRegion = dyn_cast<CapturedRegionScopeInfo>(CurCap)) { Diag(ReturnLoc, diag::err_return_in_captured_stmt) << CurRegion->getRegionName(); return StmtError(); } else { assert(CurLambda && "unknown kind of captured scope"); - if (CurLambda->CallOperator->getType()->getAs<FunctionType>() + if (CurLambda->CallOperator->getType() + ->castAs<FunctionType>() ->getNoReturnAttr()) { Diag(ReturnLoc, diag::err_noreturn_lambda_has_return_expr); return StmtError(); |