diff options
author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2022-02-12 11:18:49 +0000 |
---|---|---|
committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2022-02-12 11:18:49 +0000 |
commit | fbe0ca576d2b96c523182200529b5afbf709506f (patch) | |
tree | 0a5bfee31fa5b9e9b2b1d5cfa0f85f69a162a97e | |
parent | f0f4452ed488bc7d9c3b9693dc110f1107921a08 (diff) |
[clang][sema] checkNoThrow - use cast<> instead of dyn_cast<> to avoid dereference of nullptr
The pointer is referenced immediately, so assert the cast is correct instead of returning nullptr
-rw-r--r-- | clang/lib/Sema/SemaCoroutine.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaCoroutine.cpp b/clang/lib/Sema/SemaCoroutine.cpp index aae90c403f0f..71fcf4aebda8 100644 --- a/clang/lib/Sema/SemaCoroutine.cpp +++ b/clang/lib/Sema/SemaCoroutine.cpp @@ -680,7 +680,7 @@ static void checkNoThrow(Sema &S, const Stmt *E, QualType::DestructionKind::DK_cxx_destructor) { const auto *T = cast<RecordType>(ReturnType.getCanonicalType().getTypePtr()); - checkDeclNoexcept(dyn_cast<CXXRecordDecl>(T->getDecl())->getDestructor(), + checkDeclNoexcept(cast<CXXRecordDecl>(T->getDecl())->getDestructor(), /*IsDtor=*/true); } } else |