diff options
author | Eric Fiselier <eric@efcs.ca> | 2017-04-18 05:30:39 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2017-04-18 05:30:39 +0000 |
commit | c512875ff603ee9bf5bcb6450e2da7a6c50f6368 (patch) | |
tree | a08996df6136b864f1e694ffadbf5f27208a02b1 /clang/lib/Sema/SemaCoroutine.cpp | |
parent | f747f53238523a0230daaead55d7421b67ae0c67 (diff) | |
download | bcm5719-llvm-c512875ff603ee9bf5bcb6450e2da7a6c50f6368.tar.gz bcm5719-llvm-c512875ff603ee9bf5bcb6450e2da7a6c50f6368.zip |
Assert that a valid operator new/delete signature is always found by the coroutine body
llvm-svn: 300529
Diffstat (limited to 'clang/lib/Sema/SemaCoroutine.cpp')
-rw-r--r-- | clang/lib/Sema/SemaCoroutine.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaCoroutine.cpp b/clang/lib/Sema/SemaCoroutine.cpp index 6d8f4fac01d..c709a1a723d 100644 --- a/clang/lib/Sema/SemaCoroutine.cpp +++ b/clang/lib/Sema/SemaCoroutine.cpp @@ -912,7 +912,9 @@ bool CoroutineStmtBuilder::makeNewAndDeleteExpr() { OperatorNew, UnusedResult); } - if (OperatorNew && RequiresNoThrowAlloc) { + assert(OperatorNew && "expected definition of operator new to be found"); + + if (RequiresNoThrowAlloc) { const auto *FT = OperatorNew->getType()->getAs<FunctionProtoType>(); if (!FT->isNothrow(S.Context, /*ResultIfDependent*/ false)) { S.Diag(OperatorNew->getLocation(), @@ -924,9 +926,6 @@ bool CoroutineStmtBuilder::makeNewAndDeleteExpr() { } } - // FIXME: Diagnose and handle the case where no matching operator new is found - // (ie OperatorNew == nullptr) - if ((OperatorDelete = findDeleteForPromise(S, Loc, PromiseType)) == nullptr) return false; |